Commit 75b25d49 authored by Vishal Moola (Oracle)'s avatar Vishal Moola (Oracle) Committed by Andrew Morton

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.comSigned-off-by: default avatarVishal Moola (Oracle) <vishal.moola@gmail.com>
Acked-by: default avatarMike 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: default avatarAndrew Morton <akpm@linux-foundation.org>
parent edbaefe5
...@@ -2858,7 +2858,7 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) ...@@ -2858,7 +2858,7 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd)
return ptlock_ptr(page_ptdesc(pmd_page(*pmd))); return ptlock_ptr(page_ptdesc(pmd_page(*pmd)));
} }
static inline bool ptlock_init(struct page *page) static inline bool ptlock_init(struct ptdesc *ptdesc)
{ {
/* /*
* prep_new_page() initialize page->private (and therefore page->ptl) * prep_new_page() initialize page->private (and therefore page->ptl)
...@@ -2867,10 +2867,10 @@ static inline bool ptlock_init(struct page *page) ...@@ -2867,10 +2867,10 @@ static inline bool ptlock_init(struct page *page)
* It can happen if arch try to use slab for page table allocation: * It can happen if arch try to use slab for page table allocation:
* slab code uses page->slab_cache, which share storage with page->ptl. * slab code uses page->slab_cache, which share storage with page->ptl.
*/ */
VM_BUG_ON_PAGE(*(unsigned long *)&page->ptl, page); VM_BUG_ON_PAGE(*(unsigned long *)&ptdesc->ptl, ptdesc_page(ptdesc));
if (!ptlock_alloc(page_ptdesc(page))) if (!ptlock_alloc(ptdesc))
return false; return false;
spin_lock_init(ptlock_ptr(page_ptdesc(page))); spin_lock_init(ptlock_ptr(ptdesc));
return true; return true;
} }
...@@ -2883,13 +2883,13 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) ...@@ -2883,13 +2883,13 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd)
return &mm->page_table_lock; return &mm->page_table_lock;
} }
static inline void ptlock_cache_init(void) {} static inline void ptlock_cache_init(void) {}
static inline bool ptlock_init(struct page *page) { return true; } static inline bool ptlock_init(struct ptdesc *ptdesc) { return true; }
static inline void ptlock_free(struct page *page) {} static inline void ptlock_free(struct page *page) {}
#endif /* USE_SPLIT_PTE_PTLOCKS */ #endif /* USE_SPLIT_PTE_PTLOCKS */
static inline bool pgtable_pte_page_ctor(struct page *page) static inline bool pgtable_pte_page_ctor(struct page *page)
{ {
if (!ptlock_init(page)) if (!ptlock_init(page_ptdesc(page)))
return false; return false;
__SetPageTable(page); __SetPageTable(page);
inc_lruvec_page_state(page, NR_PAGETABLE); inc_lruvec_page_state(page, NR_PAGETABLE);
...@@ -2964,7 +2964,7 @@ static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) ...@@ -2964,7 +2964,7 @@ static inline bool pmd_ptlock_init(struct ptdesc *ptdesc)
#ifdef CONFIG_TRANSPARENT_HUGEPAGE #ifdef CONFIG_TRANSPARENT_HUGEPAGE
ptdesc->pmd_huge_pte = NULL; ptdesc->pmd_huge_pte = NULL;
#endif #endif
return ptlock_init(ptdesc_page(ptdesc)); return ptlock_init(ptdesc);
} }
static inline void pmd_ptlock_free(struct page *page) static inline void pmd_ptlock_free(struct page *page)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment