Message ID | 20230612210423.18611-11-vishal.moola@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Split ptdesc from struct page | expand |
On Mon, Jun 12, 2023 at 02:03:59PM -0700, Vishal Moola (Oracle) wrote: > This removes some direct accesses to struct page, working towards > splitting out struct ptdesc from struct page. > > Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> Acked-by: Mike Rapoport (IBM) <rppt@kernel.org> > --- > include/linux/mm.h | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index daecf1db6cf1..f48e626d9c98 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -2857,7 +2857,7 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *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) > @@ -2866,10 +2866,10 @@ static inline bool ptlock_init(struct page *page) > * 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. > */ > - VM_BUG_ON_PAGE(*(unsigned long *)&page->ptl, page); > - if (!ptlock_alloc(page_ptdesc(page))) > + VM_BUG_ON_PAGE(*(unsigned long *)&ptdesc->ptl, ptdesc_page(ptdesc)); > + if (!ptlock_alloc(ptdesc)) > return false; > - spin_lock_init(ptlock_ptr(page_ptdesc(page))); > + spin_lock_init(ptlock_ptr(ptdesc)); > return true; > } > > @@ -2882,13 +2882,13 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) > return &mm->page_table_lock; > } > 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) {} > #endif /* USE_SPLIT_PTE_PTLOCKS */ > > static inline bool pgtable_pte_page_ctor(struct page *page) > { > - if (!ptlock_init(page)) > + if (!ptlock_init(page_ptdesc(page))) > return false; > __SetPageTable(page); > inc_lruvec_page_state(page, NR_PAGETABLE); > @@ -2947,7 +2947,7 @@ static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) > #ifdef CONFIG_TRANSPARENT_HUGEPAGE > ptdesc->pmd_huge_pte = NULL; > #endif > - return ptlock_init(ptdesc_page(ptdesc)); > + return ptlock_init(ptdesc); > } > > static inline void pmd_ptlock_free(struct page *page) > -- > 2.40.1 > >
diff --git a/include/linux/mm.h b/include/linux/mm.h index daecf1db6cf1..f48e626d9c98 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2857,7 +2857,7 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *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) @@ -2866,10 +2866,10 @@ static inline bool ptlock_init(struct page *page) * 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. */ - VM_BUG_ON_PAGE(*(unsigned long *)&page->ptl, page); - if (!ptlock_alloc(page_ptdesc(page))) + VM_BUG_ON_PAGE(*(unsigned long *)&ptdesc->ptl, ptdesc_page(ptdesc)); + if (!ptlock_alloc(ptdesc)) return false; - spin_lock_init(ptlock_ptr(page_ptdesc(page))); + spin_lock_init(ptlock_ptr(ptdesc)); return true; } @@ -2882,13 +2882,13 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) return &mm->page_table_lock; } 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) {} #endif /* USE_SPLIT_PTE_PTLOCKS */ static inline bool pgtable_pte_page_ctor(struct page *page) { - if (!ptlock_init(page)) + if (!ptlock_init(page_ptdesc(page))) return false; __SetPageTable(page); inc_lruvec_page_state(page, NR_PAGETABLE); @@ -2947,7 +2947,7 @@ static inline bool pmd_ptlock_init(struct ptdesc *ptdesc) #ifdef CONFIG_TRANSPARENT_HUGEPAGE ptdesc->pmd_huge_pte = NULL; #endif - return ptlock_init(ptdesc_page(ptdesc)); + return ptlock_init(ptdesc); } static inline void pmd_ptlock_free(struct page *page)
This removes some direct accesses to struct page, working towards splitting out struct ptdesc from struct page. Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> --- include/linux/mm.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)