[tip: x86/mm] x86/xen: Convert xen_mm_unpin_all() to ptdescs

tip-bot2 for Vishal Moola posted 1 patch 1 week, 4 days ago
arch/x86/xen/mmu_pv.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
[tip: x86/mm] x86/xen: Convert xen_mm_unpin_all() to ptdescs
Posted by tip-bot2 for Vishal Moola 1 week, 4 days ago
The following commit has been merged into the x86/mm branch of tip:

Commit-ID:     defbd61c2ab01654b37750ed1515864523280cc4
Gitweb:        https://git.kernel.org/tip/defbd61c2ab01654b37750ed1515864523280cc4
Author:        Vishal Moola <vishal.moola@gmail.com>
AuthorDate:    Mon, 29 Jun 2026 11:57:42 -07:00
Committer:     Dave Hansen <dave.hansen@linux.intel.com>
CommitterDate: Mon, 13 Jul 2026 15:55:10 -07:00

x86/xen: Convert xen_mm_unpin_all() to ptdescs

Convert xen_mm_unpin_all() to ptdescs in preparation for the eventual
splitting of ptdescs from struct page. Continue checking PagePinned
through the underlying page as we do not have a per-memdesc api yet.

Signed-off-by: Vishal Moola <vishal.moola@gmail.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: William Kucharski <william.kucharski@linux.dev>
Reviewed-by: Juergen Gross <jgross@suse.com>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Link: https://patch.msgid.link/20260629185742.126987-10-vishal.moola@gmail.com
---
 arch/x86/xen/mmu_pv.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c
index d2b3bbd..377c3c0 100644
--- a/arch/x86/xen/mmu_pv.c
+++ b/arch/x86/xen/mmu_pv.c
@@ -947,16 +947,16 @@ static void xen_pgd_unpin(struct mm_struct *mm)
  */
 void xen_mm_unpin_all(void)
 {
-	struct page *page;
+	struct ptdesc *ptdesc;
 
 	spin_lock(&init_mm.page_table_lock);
 	spin_lock(&pgd_lock);
 
-	list_for_each_entry(page, &pgd_list, lru) {
-		if (PageSavePinned(page)) {
-			BUG_ON(!PagePinned(page));
-			__xen_pgd_unpin(&init_mm, (pgd_t *)page_address(page));
-			ClearPageSavePinned(page);
+	list_for_each_entry(ptdesc, &pgd_list, pt_list) {
+		if (PageSavePinned(ptdesc_page(ptdesc))) {
+			BUG_ON(!PagePinned(ptdesc_page(ptdesc)));
+			__xen_pgd_unpin(&init_mm, (pgd_t *)ptdesc_address(ptdesc));
+			ClearPageSavePinned(ptdesc_page(ptdesc));
 		}
 	}