Skip to content

Commit 75b25d4

Browse files
VMoolaakpm00
authored andcommitted
mm: convert ptlock_init() to use ptdescs
This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Link: https://lkml.kernel.org/r/20230807230513.102486-9-vishal.moola@gmail.com Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> Acked-by: Mike Rapoport (IBM) <rppt@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Christophe Leroy <christophe.leroy@csgroup.eu> Cc: Claudio Imbrenda <imbrenda@linux.ibm.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: David Hildenbrand <david@redhat.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Dinh Nguyen <dinguyen@kernel.org> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Geert Uytterhoeven <geert+renesas@glider.be> Cc: Guo Ren <guoren@kernel.org> Cc: Huacai Chen <chenhuacai@kernel.org> Cc: Hugh Dickins <hughd@google.com> Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Cc: Jonas Bonn <jonas@southpole.se> Cc: Matthew Wilcox <willy@infradead.org> Cc: Palmer Dabbelt <palmer@rivosinc.com> Cc: Paul Walmsley <paul.walmsley@sifive.com> Cc: Richard Weinberger <richard@nod.at> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent edbaefe commit 75b25d4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

include/linux/mm.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2858,7 +2858,7 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd)
28582858
return ptlock_ptr(page_ptdesc(pmd_page(*pmd)));
28592859
}
28602860

2861-
static inline bool ptlock_init(struct page *page)
2861+
static inline bool ptlock_init(struct ptdesc *ptdesc)
28622862
{
28632863
/*
28642864
* prep_new_page() initialize page->private (and therefore page->ptl)
@@ -2867,10 +2867,10 @@ static inline bool ptlock_init(struct page *page)
28672867
* It can happen if arch try to use slab for page table allocation:
28682868
* slab code uses page->slab_cache, which share storage with page->ptl.
28692869
*/
2870-
VM_BUG_ON_PAGE(*(unsigned long *)&page->ptl, page);
2871-
if (!ptlock_alloc(page_ptdesc(page)))
2870+
VM_BUG_ON_PAGE(*(unsigned long *)&ptdesc->ptl, ptdesc_page(ptdesc));
2871+
if (!ptlock_alloc(ptdesc))
28722872
return false;
2873-
spin_lock_init(ptlock_ptr(page_ptdesc(page)));
2873+
spin_lock_init(ptlock_ptr(ptdesc));
28742874
return true;
28752875
}
28762876

@@ -2883,13 +2883,13 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd)
28832883
return &mm->page_table_lock;
28842884
}
28852885
static inline void ptlock_cache_init(void) {}
2886-
static inline bool ptlock_init(struct page *page) { return true; }
2886+
static inline bool ptlock_init(struct ptdesc *ptdesc) { return true; }
28872887
static inline void ptlock_free(struct page *page) {}
28882888
#endif /* USE_SPLIT_PTE_PTLOCKS */
28892889

28902890
static inline bool pgtable_pte_page_ctor(struct page *page)
28912891
{
2892-
if (!ptlock_init(page))
2892+
if (!ptlock_init(page_ptdesc(page)))
28932893
return false;
28942894
__SetPageTable(page);
28952895
inc_lruvec_page_state(page, NR_PAGETABLE);
@@ -2964,7 +2964,7 @@ static inline bool pmd_ptlock_init(struct ptdesc *ptdesc)
29642964
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
29652965
ptdesc->pmd_huge_pte = NULL;
29662966
#endif
2967-
return ptlock_init(ptdesc_page(ptdesc));
2967+
return ptlock_init(ptdesc);
29682968
}
29692969

29702970
static inline void pmd_ptlock_free(struct page *page)

0 commit comments

Comments
 (0)