diff mbox series

[RFC,01/18] mm/pgtable: use ptdesc in pte_free_now/pte_free_defer

Message ID 20240730064712.3714387-2-alexs@kernel.org (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series use struct ptdesc to replace pgtable_t | expand

Checks

Context Check Description
conchuod/vmtest-fixes-PR fail merge-conflict

Commit Message

alexs@kernel.org July 30, 2024, 6:46 a.m. UTC
From: Alex Shi <alexs@kernel.org>

page table descriptor is splited from struct page, use it to replace struct
page in right place.

Signed-off-by: Alex Shi <alexs@kernel.org>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Matthew Wilcox  <willy@infradead.org>
Cc: David Hildenbrand <david@redhat.com>
---
 mm/pgtable-generic.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c
index 13a7705df3f8..2ce714f1dd15 100644
--- a/mm/pgtable-generic.c
+++ b/mm/pgtable-generic.c
@@ -238,18 +238,17 @@  pmd_t pmdp_collapse_flush(struct vm_area_struct *vma, unsigned long address,
 #ifndef pte_free_defer
 static void pte_free_now(struct rcu_head *head)
 {
-	struct page *page;
+	struct ptdesc *ptdesc;
 
-	page = container_of(head, struct page, rcu_head);
-	pte_free(NULL /* mm not passed and not used */, (pgtable_t)page);
+	ptdesc = container_of(head, struct ptdesc, pt_rcu_head);
+	pte_free(NULL /* mm not passed and not used */, (pgtable_t)ptdesc);
 }
 
 void pte_free_defer(struct mm_struct *mm, pgtable_t pgtable)
 {
-	struct page *page;
+	struct ptdesc *ptdesc = page_ptdesc(pgtable);
 
-	page = pgtable;
-	call_rcu(&page->rcu_head, pte_free_now);
+	call_rcu(&ptdesc->pt_rcu_head, pte_free_now);
 }
 #endif /* pte_free_defer */
 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
@@ -330,7 +329,7 @@  pte_t *pte_offset_map_nolock(struct mm_struct *mm, pmd_t *pmd,
  * kmapped if necessary (when CONFIG_HIGHPTE), and locked against concurrent
  * modification by software, with a pointer to that spinlock in ptlp (in some
  * configs mm->page_table_lock, in SPLIT_PTLOCK configs a spinlock in table's
- * struct page).  pte_unmap_unlock(pte, ptl) to unlock and unmap afterwards.
+ * struct ptdesc).  pte_unmap_unlock(pte, ptl) to unlock and unmap afterwards.
  *
  * But it is unsuccessful, returning NULL with *ptlp unchanged, if there is no
  * page table at *pmd: if, for example, the page table has just been removed,