Skip to content

Commit b4ed71f

Browse files
mrutland-armtorvalds
authored andcommitted
mm: treewide: clarify pgtable_page_{ctor,dtor}() naming
The naming of pgtable_page_{ctor,dtor}() seems to have confused a few people, and until recently arm64 used these erroneously/pointlessly for other levels of page table. To make it incredibly clear that these only apply to the PTE level, and to align with the naming of pgtable_pmd_page_{ctor,dtor}(), let's rename them to pgtable_pte_page_{ctor,dtor}(). These changes were generated with the following shell script: ---- git grep -lw 'pgtable_page_.tor' | while read FILE; do sed -i '{s/pgtable_page_ctor/pgtable_pte_page_ctor/}' $FILE; sed -i '{s/pgtable_page_dtor/pgtable_pte_page_dtor/}' $FILE; done ---- ... with the documentation re-flowed to remain under 80 columns, and whitespace fixed up in macros to keep backslashes aligned. There should be no functional change as a result of this patch. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Mark Rutland <[email protected]> Reviewed-by: Mike Rapoport <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> [m68k] Cc: Anshuman Khandual <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Yu Zhao <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent cc22c80 commit b4ed71f

File tree

26 files changed

+48
-48
lines changed

26 files changed

+48
-48
lines changed

Documentation/vm/split_page_table_lock.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ Hugetlb-specific helpers:
5454
Support of split page table lock by an architecture
5555
===================================================
5656

57-
There's no need in special enabling of PTE split page table lock:
58-
everything required is done by pgtable_page_ctor() and pgtable_page_dtor(),
59-
which must be called on PTE table allocation / freeing.
57+
There's no need in special enabling of PTE split page table lock: everything
58+
required is done by pgtable_pte_page_ctor() and pgtable_pte_page_dtor(), which
59+
must be called on PTE table allocation / freeing.
6060

6161
Make sure the architecture doesn't use slab allocator for page table
6262
allocation: slab uses page->slab_cache for its pages.
@@ -74,7 +74,7 @@ paths: i.e X86_PAE preallocate few PMDs on pgd_alloc().
7474

7575
With everything in place you can set CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK.
7676

77-
NOTE: pgtable_page_ctor() and pgtable_pmd_page_ctor() can fail -- it must
77+
NOTE: pgtable_pte_page_ctor() and pgtable_pmd_page_ctor() can fail -- it must
7878
be handled properly.
7979

8080
page->ptl
@@ -94,7 +94,7 @@ trick:
9494
split lock with enabled DEBUG_SPINLOCK or DEBUG_LOCK_ALLOC, but costs
9595
one more cache line for indirect access;
9696

97-
The spinlock_t allocated in pgtable_page_ctor() for PTE table and in
97+
The spinlock_t allocated in pgtable_pte_page_ctor() for PTE table and in
9898
pgtable_pmd_page_ctor() for PMD table.
9999

100100
Please, never access page->ptl directly -- use appropriate helper.

arch/arc/include/asm/pgalloc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ pte_alloc_one(struct mm_struct *mm)
108108
return 0;
109109
memzero((void *)pte_pg, PTRS_PER_PTE * sizeof(pte_t));
110110
page = virt_to_page(pte_pg);
111-
if (!pgtable_page_ctor(page)) {
111+
if (!pgtable_pte_page_ctor(page)) {
112112
__free_page(page);
113113
return 0;
114114
}
@@ -123,7 +123,7 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
123123

124124
static inline void pte_free(struct mm_struct *mm, pgtable_t ptep)
125125
{
126-
pgtable_page_dtor(virt_to_page(ptep));
126+
pgtable_pte_page_dtor(virt_to_page(ptep));
127127
free_pages((unsigned long)ptep, __get_order_pte());
128128
}
129129

arch/arm/include/asm/tlb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static inline void __tlb_remove_table(void *_table)
4444
static inline void
4545
__pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr)
4646
{
47-
pgtable_page_dtor(pte);
47+
pgtable_pte_page_dtor(pte);
4848

4949
#ifndef CONFIG_ARM_LPAE
5050
/*

arch/arm/mm/mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ static void *__init late_alloc(unsigned long sz)
731731
{
732732
void *ptr = (void *)__get_free_pages(GFP_PGTABLE_KERNEL, get_order(sz));
733733

734-
if (!ptr || !pgtable_page_ctor(virt_to_page(ptr)))
734+
if (!ptr || !pgtable_pte_page_ctor(virt_to_page(ptr)))
735735
BUG();
736736
return ptr;
737737
}

arch/arm64/include/asm/tlb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static inline void tlb_flush(struct mmu_gather *tlb)
4444
static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
4545
unsigned long addr)
4646
{
47-
pgtable_page_dtor(pte);
47+
pgtable_pte_page_dtor(pte);
4848
tlb_remove_table(tlb, pte);
4949
}
5050

arch/arm64/mm/mmu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ static phys_addr_t pgd_pgtable_alloc(int shift)
384384
* folded, and if so pgtable_pmd_page_ctor() becomes nop.
385385
*/
386386
if (shift == PAGE_SHIFT)
387-
BUG_ON(!pgtable_page_ctor(phys_to_page(pa)));
387+
BUG_ON(!pgtable_pte_page_ctor(phys_to_page(pa)));
388388
else if (shift == PMD_SHIFT)
389389
BUG_ON(!pgtable_pmd_page_ctor(phys_to_page(pa)));
390390

arch/csky/include/asm/pgalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
7171

7272
#define __pte_free_tlb(tlb, pte, address) \
7373
do { \
74-
pgtable_page_dtor(pte); \
74+
pgtable_pte_page_dtor(pte); \
7575
tlb_remove_page(tlb, pte); \
7676
} while (0)
7777

arch/hexagon/include/asm/pgalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
9494

9595
#define __pte_free_tlb(tlb, pte, addr) \
9696
do { \
97-
pgtable_page_dtor((pte)); \
97+
pgtable_pte_page_dtor((pte)); \
9898
tlb_remove_page((tlb), (pte)); \
9999
} while (0)
100100

arch/m68k/include/asm/mcf_pgalloc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address)
4141
static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t page,
4242
unsigned long address)
4343
{
44-
pgtable_page_dtor(page);
44+
pgtable_pte_page_dtor(page);
4545
__free_page(page);
4646
}
4747

@@ -54,7 +54,7 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm)
5454

5555
if (!page)
5656
return NULL;
57-
if (!pgtable_page_ctor(page)) {
57+
if (!pgtable_pte_page_ctor(page)) {
5858
__free_page(page);
5959
return NULL;
6060
}
@@ -73,7 +73,7 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm)
7373

7474
static inline void pte_free(struct mm_struct *mm, struct page *page)
7575
{
76-
pgtable_page_dtor(page);
76+
pgtable_pte_page_dtor(page);
7777
__free_page(page);
7878
}
7979

arch/m68k/include/asm/motorola_pgalloc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
3636
page = alloc_pages(GFP_KERNEL|__GFP_ZERO, 0);
3737
if(!page)
3838
return NULL;
39-
if (!pgtable_page_ctor(page)) {
39+
if (!pgtable_pte_page_ctor(page)) {
4040
__free_page(page);
4141
return NULL;
4242
}
@@ -51,7 +51,7 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
5151

5252
static inline void pte_free(struct mm_struct *mm, pgtable_t page)
5353
{
54-
pgtable_page_dtor(page);
54+
pgtable_pte_page_dtor(page);
5555
cache_page(kmap(page));
5656
kunmap(page);
5757
__free_page(page);
@@ -60,7 +60,7 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t page)
6060
static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t page,
6161
unsigned long address)
6262
{
63-
pgtable_page_dtor(page);
63+
pgtable_pte_page_dtor(page);
6464
cache_page(kmap(page));
6565
kunmap(page);
6666
__free_page(page);

arch/m68k/include/asm/sun3_pgalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ extern const char bad_pmd_string[];
2121

2222
#define __pte_free_tlb(tlb,pte,addr) \
2323
do { \
24-
pgtable_page_dtor(pte); \
24+
pgtable_pte_page_dtor(pte); \
2525
tlb_remove_page((tlb), pte); \
2626
} while (0)
2727

arch/mips/include/asm/pgalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
5454

5555
#define __pte_free_tlb(tlb,pte,address) \
5656
do { \
57-
pgtable_page_dtor(pte); \
57+
pgtable_pte_page_dtor(pte); \
5858
tlb_remove_page((tlb), pte); \
5959
} while (0)
6060

arch/nios2/include/asm/pgalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
4141

4242
#define __pte_free_tlb(tlb, pte, addr) \
4343
do { \
44-
pgtable_page_dtor(pte); \
44+
pgtable_pte_page_dtor(pte); \
4545
tlb_remove_page((tlb), (pte)); \
4646
} while (0)
4747

arch/openrisc/include/asm/pgalloc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm)
7575
if (!pte)
7676
return NULL;
7777
clear_page(page_address(pte));
78-
if (!pgtable_page_ctor(pte)) {
78+
if (!pgtable_pte_page_ctor(pte)) {
7979
__free_page(pte);
8080
return NULL;
8181
}
@@ -89,13 +89,13 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
8989

9090
static inline void pte_free(struct mm_struct *mm, struct page *pte)
9191
{
92-
pgtable_page_dtor(pte);
92+
pgtable_pte_page_dtor(pte);
9393
__free_page(pte);
9494
}
9595

9696
#define __pte_free_tlb(tlb, pte, addr) \
9797
do { \
98-
pgtable_page_dtor(pte); \
98+
pgtable_pte_page_dtor(pte); \
9999
tlb_remove_page((tlb), (pte)); \
100100
} while (0)
101101

arch/powerpc/mm/pgtable-frag.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ void pte_frag_destroy(void *pte_frag)
2525
count = ((unsigned long)pte_frag & ~PAGE_MASK) >> PTE_FRAG_SIZE_SHIFT;
2626
/* We allow PTE_FRAG_NR fragments from a PTE page */
2727
if (atomic_sub_and_test(PTE_FRAG_NR - count, &page->pt_frag_refcount)) {
28-
pgtable_page_dtor(page);
28+
pgtable_pte_page_dtor(page);
2929
__free_page(page);
3030
}
3131
}
@@ -61,7 +61,7 @@ static pte_t *__alloc_for_ptecache(struct mm_struct *mm, int kernel)
6161
page = alloc_page(PGALLOC_GFP | __GFP_ACCOUNT);
6262
if (!page)
6363
return NULL;
64-
if (!pgtable_page_ctor(page)) {
64+
if (!pgtable_pte_page_ctor(page)) {
6565
__free_page(page);
6666
return NULL;
6767
}
@@ -113,7 +113,7 @@ void pte_fragment_free(unsigned long *table, int kernel)
113113
BUG_ON(atomic_read(&page->pt_frag_refcount) <= 0);
114114
if (atomic_dec_and_test(&page->pt_frag_refcount)) {
115115
if (!kernel)
116-
pgtable_page_dtor(page);
116+
pgtable_pte_page_dtor(page);
117117
__free_page(page);
118118
}
119119
}

arch/riscv/include/asm/pgalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
7878

7979
#define __pte_free_tlb(tlb, pte, buf) \
8080
do { \
81-
pgtable_page_dtor(pte); \
81+
pgtable_pte_page_dtor(pte); \
8282
tlb_remove_page((tlb), pte); \
8383
} while (0)
8484

arch/s390/mm/pgalloc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ unsigned long *page_table_alloc(struct mm_struct *mm)
210210
page = alloc_page(GFP_KERNEL);
211211
if (!page)
212212
return NULL;
213-
if (!pgtable_page_ctor(page)) {
213+
if (!pgtable_pte_page_ctor(page)) {
214214
__free_page(page);
215215
return NULL;
216216
}
@@ -256,7 +256,7 @@ void page_table_free(struct mm_struct *mm, unsigned long *table)
256256
atomic_xor_bits(&page->_refcount, 3U << 24);
257257
}
258258

259-
pgtable_page_dtor(page);
259+
pgtable_pte_page_dtor(page);
260260
__free_page(page);
261261
}
262262

@@ -308,7 +308,7 @@ void __tlb_remove_table(void *_table)
308308
case 3: /* 4K page table with pgstes */
309309
if (mask & 3)
310310
atomic_xor_bits(&page->_refcount, 3 << 24);
311-
pgtable_page_dtor(page);
311+
pgtable_pte_page_dtor(page);
312312
__free_page(page);
313313
break;
314314
}

arch/sh/include/asm/pgalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
2929

3030
#define __pte_free_tlb(tlb,pte,addr) \
3131
do { \
32-
pgtable_page_dtor(pte); \
32+
pgtable_pte_page_dtor(pte); \
3333
tlb_remove_page((tlb), (pte)); \
3434
} while (0)
3535

arch/sparc/mm/init_64.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2903,7 +2903,7 @@ pgtable_t pte_alloc_one(struct mm_struct *mm)
29032903
struct page *page = alloc_page(GFP_KERNEL | __GFP_ZERO);
29042904
if (!page)
29052905
return NULL;
2906-
if (!pgtable_page_ctor(page)) {
2906+
if (!pgtable_pte_page_ctor(page)) {
29072907
free_unref_page(page);
29082908
return NULL;
29092909
}
@@ -2919,7 +2919,7 @@ static void __pte_free(pgtable_t pte)
29192919
{
29202920
struct page *page = virt_to_page(pte);
29212921

2922-
pgtable_page_dtor(page);
2922+
pgtable_pte_page_dtor(page);
29232923
__free_page(page);
29242924
}
29252925

arch/sparc/mm/srmmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ pgtable_t pte_alloc_one(struct mm_struct *mm)
378378
if ((pte = (unsigned long)pte_alloc_one_kernel(mm)) == 0)
379379
return NULL;
380380
page = pfn_to_page(__nocache_pa(pte) >> PAGE_SHIFT);
381-
if (!pgtable_page_ctor(page)) {
381+
if (!pgtable_pte_page_ctor(page)) {
382382
__free_page(page);
383383
return NULL;
384384
}
@@ -389,7 +389,7 @@ void pte_free(struct mm_struct *mm, pgtable_t pte)
389389
{
390390
unsigned long p;
391391

392-
pgtable_page_dtor(pte);
392+
pgtable_pte_page_dtor(pte);
393393
p = (unsigned long)page_address(pte); /* Cached address (for test) */
394394
if (p == 0)
395395
BUG();

arch/um/include/asm/pgalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
2929

3030
#define __pte_free_tlb(tlb,pte, address) \
3131
do { \
32-
pgtable_page_dtor(pte); \
32+
pgtable_pte_page_dtor(pte); \
3333
tlb_remove_page((tlb),(pte)); \
3434
} while (0)
3535

arch/unicore32/include/asm/tlb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#define __pte_free_tlb(tlb, pte, addr) \
1717
do { \
18-
pgtable_page_dtor(pte); \
18+
pgtable_pte_page_dtor(pte); \
1919
tlb_remove_page((tlb), (pte)); \
2020
} while (0)
2121

arch/x86/mm/pgtable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ early_param("userpte", setup_userpte);
4545

4646
void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte)
4747
{
48-
pgtable_page_dtor(pte);
48+
pgtable_pte_page_dtor(pte);
4949
paravirt_release_pte(page_to_pfn(pte));
5050
paravirt_tlb_remove_table(tlb, pte);
5151
}

arch/xtensa/include/asm/pgalloc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
5555
if (!pte)
5656
return NULL;
5757
page = virt_to_page(pte);
58-
if (!pgtable_page_ctor(page)) {
58+
if (!pgtable_pte_page_ctor(page)) {
5959
__free_page(page);
6060
return NULL;
6161
}
@@ -69,7 +69,7 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
6969

7070
static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
7171
{
72-
pgtable_page_dtor(pte);
72+
pgtable_pte_page_dtor(pte);
7373
__free_page(pte);
7474
}
7575
#define pmd_pgtable(pmd) pmd_page(pmd)

include/asm-generic/pgalloc.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
4949
* @mm: the mm_struct of the current context
5050
* @gfp: GFP flags to use for the allocation
5151
*
52-
* Allocates a page and runs the pgtable_page_ctor().
52+
* Allocates a page and runs the pgtable_pte_page_ctor().
5353
*
5454
* This function is intended for architectures that need
5555
* anything beyond simple page allocation or must have custom GFP flags.
@@ -63,7 +63,7 @@ static inline pgtable_t __pte_alloc_one(struct mm_struct *mm, gfp_t gfp)
6363
pte = alloc_page(gfp);
6464
if (!pte)
6565
return NULL;
66-
if (!pgtable_page_ctor(pte)) {
66+
if (!pgtable_pte_page_ctor(pte)) {
6767
__free_page(pte);
6868
return NULL;
6969
}
@@ -76,7 +76,7 @@ static inline pgtable_t __pte_alloc_one(struct mm_struct *mm, gfp_t gfp)
7676
* pte_alloc_one - allocate a page for PTE-level user page table
7777
* @mm: the mm_struct of the current context
7878
*
79-
* Allocates a page and runs the pgtable_page_ctor().
79+
* Allocates a page and runs the pgtable_pte_page_ctor().
8080
*
8181
* Return: `struct page` initialized as page table or %NULL on error
8282
*/
@@ -98,7 +98,7 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
9898
*/
9999
static inline void pte_free(struct mm_struct *mm, struct page *pte_page)
100100
{
101-
pgtable_page_dtor(pte_page);
101+
pgtable_pte_page_dtor(pte_page);
102102
__free_page(pte_page);
103103
}
104104

0 commit comments

Comments
 (0)