summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Rutland <mark.rutland@arm.com>2019-09-25 19:49:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-09-26 13:10:44 -0400
commitb4ed71f557e458257e0f71b11969954acb389240 (patch)
tree37be2ba912b15dcb0104badeea1eba798bec2fed
parentcc22c800e15b03c87f0e97400f75eba998e75c6a (diff)
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/20190722141133.3116-1-mark.rutland@arm.com Signed-off-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Mike Rapoport <rppt@linux.ibm.com> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> [m68k] Cc: Anshuman Khandual <anshuman.khandual@arm.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Yu Zhao <yuzhao@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--Documentation/vm/split_page_table_lock.rst10
-rw-r--r--arch/arc/include/asm/pgalloc.h4
-rw-r--r--arch/arm/include/asm/tlb.h2
-rw-r--r--arch/arm/mm/mmu.c2
-rw-r--r--arch/arm64/include/asm/tlb.h2
-rw-r--r--arch/arm64/mm/mmu.c2
-rw-r--r--arch/csky/include/asm/pgalloc.h2
-rw-r--r--arch/hexagon/include/asm/pgalloc.h2
-rw-r--r--arch/m68k/include/asm/mcf_pgalloc.h6
-rw-r--r--arch/m68k/include/asm/motorola_pgalloc.h6
-rw-r--r--arch/m68k/include/asm/sun3_pgalloc.h2
-rw-r--r--arch/mips/include/asm/pgalloc.h2
-rw-r--r--arch/nios2/include/asm/pgalloc.h2
-rw-r--r--arch/openrisc/include/asm/pgalloc.h6
-rw-r--r--arch/powerpc/mm/pgtable-frag.c6
-rw-r--r--arch/riscv/include/asm/pgalloc.h2
-rw-r--r--arch/s390/mm/pgalloc.c6
-rw-r--r--arch/sh/include/asm/pgalloc.h2
-rw-r--r--arch/sparc/mm/init_64.c4
-rw-r--r--arch/sparc/mm/srmmu.c4
-rw-r--r--arch/um/include/asm/pgalloc.h2
-rw-r--r--arch/unicore32/include/asm/tlb.h2
-rw-r--r--arch/x86/mm/pgtable.c2
-rw-r--r--arch/xtensa/include/asm/pgalloc.h4
-rw-r--r--include/asm-generic/pgalloc.h8
-rw-r--r--include/linux/mm.h4
26 files changed, 48 insertions, 48 deletions
diff --git a/Documentation/vm/split_page_table_lock.rst b/Documentation/vm/split_page_table_lock.rst
index 889b00be469f..ff51f4a5494d 100644
--- a/Documentation/vm/split_page_table_lock.rst
+++ b/Documentation/vm/split_page_table_lock.rst
@@ -54,9 +54,9 @@ Hugetlb-specific helpers:
54Support of split page table lock by an architecture 54Support of split page table lock by an architecture
55=================================================== 55===================================================
56 56
57There's no need in special enabling of PTE split page table lock: 57There's no need in special enabling of PTE split page table lock: everything
58everything required is done by pgtable_page_ctor() and pgtable_page_dtor(), 58required is done by pgtable_pte_page_ctor() and pgtable_pte_page_dtor(), which
59which must be called on PTE table allocation / freeing. 59must be called on PTE table allocation / freeing.
60 60
61Make sure the architecture doesn't use slab allocator for page table 61Make sure the architecture doesn't use slab allocator for page table
62allocation: slab uses page->slab_cache for its pages. 62allocation: slab uses page->slab_cache for its pages.
@@ -74,7 +74,7 @@ paths: i.e X86_PAE preallocate few PMDs on pgd_alloc().
74 74
75With everything in place you can set CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK. 75With everything in place you can set CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK.
76 76
77NOTE: pgtable_page_ctor() and pgtable_pmd_page_ctor() can fail -- it must 77NOTE: pgtable_pte_page_ctor() and pgtable_pmd_page_ctor() can fail -- it must
78be handled properly. 78be handled properly.
79 79
80page->ptl 80page->ptl
@@ -94,7 +94,7 @@ trick:
94 split lock with enabled DEBUG_SPINLOCK or DEBUG_LOCK_ALLOC, but costs 94 split lock with enabled DEBUG_SPINLOCK or DEBUG_LOCK_ALLOC, but costs
95 one more cache line for indirect access; 95 one more cache line for indirect access;
96 96
97The spinlock_t allocated in pgtable_page_ctor() for PTE table and in 97The spinlock_t allocated in pgtable_pte_page_ctor() for PTE table and in
98pgtable_pmd_page_ctor() for PMD table. 98pgtable_pmd_page_ctor() for PMD table.
99 99
100Please, never access page->ptl directly -- use appropriate helper. 100Please, never access page->ptl directly -- use appropriate helper.
diff --git a/arch/arc/include/asm/pgalloc.h b/arch/arc/include/asm/pgalloc.h
index 4751f2251cd9..b747f2ec2928 100644
--- a/arch/arc/include/asm/pgalloc.h
+++ b/arch/arc/include/asm/pgalloc.h
@@ -108,7 +108,7 @@ pte_alloc_one(struct mm_struct *mm)
108 return 0; 108 return 0;
109 memzero((void *)pte_pg, PTRS_PER_PTE * sizeof(pte_t)); 109 memzero((void *)pte_pg, PTRS_PER_PTE * sizeof(pte_t));
110 page = virt_to_page(pte_pg); 110 page = virt_to_page(pte_pg);
111 if (!pgtable_page_ctor(page)) { 111 if (!pgtable_pte_page_ctor(page)) {
112 __free_page(page); 112 __free_page(page);
113 return 0; 113 return 0;
114 } 114 }
@@ -123,7 +123,7 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
123 123
124static inline void pte_free(struct mm_struct *mm, pgtable_t ptep) 124static inline void pte_free(struct mm_struct *mm, pgtable_t ptep)
125{ 125{
126 pgtable_page_dtor(virt_to_page(ptep)); 126 pgtable_pte_page_dtor(virt_to_page(ptep));
127 free_pages((unsigned long)ptep, __get_order_pte()); 127 free_pages((unsigned long)ptep, __get_order_pte());
128} 128}
129 129
diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h
index b75ea15b85c0..669474add486 100644
--- a/arch/arm/include/asm/tlb.h
+++ b/arch/arm/include/asm/tlb.h
@@ -44,7 +44,7 @@ static inline void __tlb_remove_table(void *_table)
44static inline void 44static inline void
45__pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr) 45__pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, unsigned long addr)
46{ 46{
47 pgtable_page_dtor(pte); 47 pgtable_pte_page_dtor(pte);
48 48
49#ifndef CONFIG_ARM_LPAE 49#ifndef CONFIG_ARM_LPAE
50 /* 50 /*
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 25da9b2d9610..48c2888297dd 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -731,7 +731,7 @@ static void *__init late_alloc(unsigned long sz)
731{ 731{
732 void *ptr = (void *)__get_free_pages(GFP_PGTABLE_KERNEL, get_order(sz)); 732 void *ptr = (void *)__get_free_pages(GFP_PGTABLE_KERNEL, get_order(sz));
733 733
734 if (!ptr || !pgtable_page_ctor(virt_to_page(ptr))) 734 if (!ptr || !pgtable_pte_page_ctor(virt_to_page(ptr)))
735 BUG(); 735 BUG();
736 return ptr; 736 return ptr;
737} 737}
diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h
index a95d1fcb7e21..b76df828e6b7 100644
--- a/arch/arm64/include/asm/tlb.h
+++ b/arch/arm64/include/asm/tlb.h
@@ -44,7 +44,7 @@ static inline void tlb_flush(struct mmu_gather *tlb)
44static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, 44static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
45 unsigned long addr) 45 unsigned long addr)
46{ 46{
47 pgtable_page_dtor(pte); 47 pgtable_pte_page_dtor(pte);
48 tlb_remove_table(tlb, pte); 48 tlb_remove_table(tlb, pte);
49} 49}
50 50
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 53dc6f24cfb7..60c929f3683b 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -384,7 +384,7 @@ static phys_addr_t pgd_pgtable_alloc(int shift)
384 * folded, and if so pgtable_pmd_page_ctor() becomes nop. 384 * folded, and if so pgtable_pmd_page_ctor() becomes nop.
385 */ 385 */
386 if (shift == PAGE_SHIFT) 386 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)));
388 else if (shift == PMD_SHIFT) 388 else if (shift == PMD_SHIFT)
389 BUG_ON(!pgtable_pmd_page_ctor(phys_to_page(pa))); 389 BUG_ON(!pgtable_pmd_page_ctor(phys_to_page(pa)));
390 390
diff --git a/arch/csky/include/asm/pgalloc.h b/arch/csky/include/asm/pgalloc.h
index d089113fe41f..c7c1ed27e348 100644
--- a/arch/csky/include/asm/pgalloc.h
+++ b/arch/csky/include/asm/pgalloc.h
@@ -71,7 +71,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
71 71
72#define __pte_free_tlb(tlb, pte, address) \ 72#define __pte_free_tlb(tlb, pte, address) \
73do { \ 73do { \
74 pgtable_page_dtor(pte); \ 74 pgtable_pte_page_dtor(pte); \
75 tlb_remove_page(tlb, pte); \ 75 tlb_remove_page(tlb, pte); \
76} while (0) 76} while (0)
77 77
diff --git a/arch/hexagon/include/asm/pgalloc.h b/arch/hexagon/include/asm/pgalloc.h
index 5a6e79e7926d..cc9be514a676 100644
--- a/arch/hexagon/include/asm/pgalloc.h
+++ b/arch/hexagon/include/asm/pgalloc.h
@@ -94,7 +94,7 @@ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
94 94
95#define __pte_free_tlb(tlb, pte, addr) \ 95#define __pte_free_tlb(tlb, pte, addr) \
96do { \ 96do { \
97 pgtable_page_dtor((pte)); \ 97 pgtable_pte_page_dtor((pte)); \
98 tlb_remove_page((tlb), (pte)); \ 98 tlb_remove_page((tlb), (pte)); \
99} while (0) 99} while (0)
100 100
diff --git a/arch/m68k/include/asm/mcf_pgalloc.h b/arch/m68k/include/asm/mcf_pgalloc.h
index 4399d712f6db..b34d44d666a4 100644
--- a/arch/m68k/include/asm/mcf_pgalloc.h
+++ b/arch/m68k/include/asm/mcf_pgalloc.h
@@ -41,7 +41,7 @@ extern inline pmd_t *pmd_alloc_kernel(pgd_t *pgd, unsigned long address)
41static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t page, 41static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t page,
42 unsigned long address) 42 unsigned long address)
43{ 43{
44 pgtable_page_dtor(page); 44 pgtable_pte_page_dtor(page);
45 __free_page(page); 45 __free_page(page);
46} 46}
47 47
@@ -54,7 +54,7 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm)
54 54
55 if (!page) 55 if (!page)
56 return NULL; 56 return NULL;
57 if (!pgtable_page_ctor(page)) { 57 if (!pgtable_pte_page_ctor(page)) {
58 __free_page(page); 58 __free_page(page);
59 return NULL; 59 return NULL;
60 } 60 }
@@ -73,7 +73,7 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm)
73 73
74static inline void pte_free(struct mm_struct *mm, struct page *page) 74static inline void pte_free(struct mm_struct *mm, struct page *page)
75{ 75{
76 pgtable_page_dtor(page); 76 pgtable_pte_page_dtor(page);
77 __free_page(page); 77 __free_page(page);
78} 78}
79 79
diff --git a/arch/m68k/include/asm/motorola_pgalloc.h b/arch/m68k/include/asm/motorola_pgalloc.h
index d04d9ba9b976..acab315c851f 100644
--- a/arch/m68k/include/asm/motorola_pgalloc.h
+++ b/arch/m68k/include/asm/motorola_pgalloc.h
@@ -36,7 +36,7 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
36 page = alloc_pages(GFP_KERNEL|__GFP_ZERO, 0); 36 page = alloc_pages(GFP_KERNEL|__GFP_ZERO, 0);
37 if(!page) 37 if(!page)
38 return NULL; 38 return NULL;
39 if (!pgtable_page_ctor(page)) { 39 if (!pgtable_pte_page_ctor(page)) {
40 __free_page(page); 40 __free_page(page);
41 return NULL; 41 return NULL;
42 } 42 }
@@ -51,7 +51,7 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
51 51
52static inline void pte_free(struct mm_struct *mm, pgtable_t page) 52static inline void pte_free(struct mm_struct *mm, pgtable_t page)
53{ 53{
54 pgtable_page_dtor(page); 54 pgtable_pte_page_dtor(page);
55 cache_page(kmap(page)); 55 cache_page(kmap(page));
56 kunmap(page); 56 kunmap(page);
57 __free_page(page); 57 __free_page(page);
@@ -60,7 +60,7 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t page)
60static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t page, 60static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t page,
61 unsigned long address) 61 unsigned long address)
62{ 62{
63 pgtable_page_dtor(page); 63 pgtable_pte_page_dtor(page);
64 cache_page(kmap(page)); 64 cache_page(kmap(page));
65 kunmap(page); 65 kunmap(page);
66 __free_page(page); 66 __free_page(page);
diff --git a/arch/m68k/include/asm/sun3_pgalloc.h b/arch/m68k/include/asm/sun3_pgalloc.h
index 1a8ddbd0d23c..856121122b91 100644
--- a/arch/m68k/include/asm/sun3_pgalloc.h
+++ b/arch/m68k/include/asm/sun3_pgalloc.h
@@ -21,7 +21,7 @@ extern const char bad_pmd_string[];
21 21
22#define __pte_free_tlb(tlb,pte,addr) \ 22#define __pte_free_tlb(tlb,pte,addr) \
23do { \ 23do { \
24 pgtable_page_dtor(pte); \ 24 pgtable_pte_page_dtor(pte); \
25 tlb_remove_page((tlb), pte); \ 25 tlb_remove_page((tlb), pte); \
26} while (0) 26} while (0)
27 27
diff --git a/arch/mips/include/asm/pgalloc.h b/arch/mips/include/asm/pgalloc.h
index aa73cb187a07..166842337eb2 100644
--- a/arch/mips/include/asm/pgalloc.h
+++ b/arch/mips/include/asm/pgalloc.h
@@ -54,7 +54,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
54 54
55#define __pte_free_tlb(tlb,pte,address) \ 55#define __pte_free_tlb(tlb,pte,address) \
56do { \ 56do { \
57 pgtable_page_dtor(pte); \ 57 pgtable_pte_page_dtor(pte); \
58 tlb_remove_page((tlb), pte); \ 58 tlb_remove_page((tlb), pte); \
59} while (0) 59} while (0)
60 60
diff --git a/arch/nios2/include/asm/pgalloc.h b/arch/nios2/include/asm/pgalloc.h
index 750d18d5980b..0b146d773c85 100644
--- a/arch/nios2/include/asm/pgalloc.h
+++ b/arch/nios2/include/asm/pgalloc.h
@@ -41,7 +41,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
41 41
42#define __pte_free_tlb(tlb, pte, addr) \ 42#define __pte_free_tlb(tlb, pte, addr) \
43 do { \ 43 do { \
44 pgtable_page_dtor(pte); \ 44 pgtable_pte_page_dtor(pte); \
45 tlb_remove_page((tlb), (pte)); \ 45 tlb_remove_page((tlb), (pte)); \
46 } while (0) 46 } while (0)
47 47
diff --git a/arch/openrisc/include/asm/pgalloc.h b/arch/openrisc/include/asm/pgalloc.h
index 787c1b9d2f6d..da12a4c38c4b 100644
--- a/arch/openrisc/include/asm/pgalloc.h
+++ b/arch/openrisc/include/asm/pgalloc.h
@@ -75,7 +75,7 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm)
75 if (!pte) 75 if (!pte)
76 return NULL; 76 return NULL;
77 clear_page(page_address(pte)); 77 clear_page(page_address(pte));
78 if (!pgtable_page_ctor(pte)) { 78 if (!pgtable_pte_page_ctor(pte)) {
79 __free_page(pte); 79 __free_page(pte);
80 return NULL; 80 return NULL;
81 } 81 }
@@ -89,13 +89,13 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
89 89
90static inline void pte_free(struct mm_struct *mm, struct page *pte) 90static inline void pte_free(struct mm_struct *mm, struct page *pte)
91{ 91{
92 pgtable_page_dtor(pte); 92 pgtable_pte_page_dtor(pte);
93 __free_page(pte); 93 __free_page(pte);
94} 94}
95 95
96#define __pte_free_tlb(tlb, pte, addr) \ 96#define __pte_free_tlb(tlb, pte, addr) \
97do { \ 97do { \
98 pgtable_page_dtor(pte); \ 98 pgtable_pte_page_dtor(pte); \
99 tlb_remove_page((tlb), (pte)); \ 99 tlb_remove_page((tlb), (pte)); \
100} while (0) 100} while (0)
101 101
diff --git a/arch/powerpc/mm/pgtable-frag.c b/arch/powerpc/mm/pgtable-frag.c
index a7b05214760c..ee4bd6d38602 100644
--- a/arch/powerpc/mm/pgtable-frag.c
+++ b/arch/powerpc/mm/pgtable-frag.c
@@ -25,7 +25,7 @@ void pte_frag_destroy(void *pte_frag)
25 count = ((unsigned long)pte_frag & ~PAGE_MASK) >> PTE_FRAG_SIZE_SHIFT; 25 count = ((unsigned long)pte_frag & ~PAGE_MASK) >> PTE_FRAG_SIZE_SHIFT;
26 /* We allow PTE_FRAG_NR fragments from a PTE page */ 26 /* We allow PTE_FRAG_NR fragments from a PTE page */
27 if (atomic_sub_and_test(PTE_FRAG_NR - count, &page->pt_frag_refcount)) { 27 if (atomic_sub_and_test(PTE_FRAG_NR - count, &page->pt_frag_refcount)) {
28 pgtable_page_dtor(page); 28 pgtable_pte_page_dtor(page);
29 __free_page(page); 29 __free_page(page);
30 } 30 }
31} 31}
@@ -61,7 +61,7 @@ static pte_t *__alloc_for_ptecache(struct mm_struct *mm, int kernel)
61 page = alloc_page(PGALLOC_GFP | __GFP_ACCOUNT); 61 page = alloc_page(PGALLOC_GFP | __GFP_ACCOUNT);
62 if (!page) 62 if (!page)
63 return NULL; 63 return NULL;
64 if (!pgtable_page_ctor(page)) { 64 if (!pgtable_pte_page_ctor(page)) {
65 __free_page(page); 65 __free_page(page);
66 return NULL; 66 return NULL;
67 } 67 }
@@ -113,7 +113,7 @@ void pte_fragment_free(unsigned long *table, int kernel)
113 BUG_ON(atomic_read(&page->pt_frag_refcount) <= 0); 113 BUG_ON(atomic_read(&page->pt_frag_refcount) <= 0);
114 if (atomic_dec_and_test(&page->pt_frag_refcount)) { 114 if (atomic_dec_and_test(&page->pt_frag_refcount)) {
115 if (!kernel) 115 if (!kernel)
116 pgtable_page_dtor(page); 116 pgtable_pte_page_dtor(page);
117 __free_page(page); 117 __free_page(page);
118 } 118 }
119} 119}
diff --git a/arch/riscv/include/asm/pgalloc.h b/arch/riscv/include/asm/pgalloc.h
index f66a00d8cb19..d59ea92285ec 100644
--- a/arch/riscv/include/asm/pgalloc.h
+++ b/arch/riscv/include/asm/pgalloc.h
@@ -78,7 +78,7 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
78 78
79#define __pte_free_tlb(tlb, pte, buf) \ 79#define __pte_free_tlb(tlb, pte, buf) \
80do { \ 80do { \
81 pgtable_page_dtor(pte); \ 81 pgtable_pte_page_dtor(pte); \
82 tlb_remove_page((tlb), pte); \ 82 tlb_remove_page((tlb), pte); \
83} while (0) 83} while (0)
84 84
diff --git a/arch/s390/mm/pgalloc.c b/arch/s390/mm/pgalloc.c
index 54fcdf66ae96..3dd253f81a77 100644
--- a/arch/s390/mm/pgalloc.c
+++ b/arch/s390/mm/pgalloc.c
@@ -210,7 +210,7 @@ unsigned long *page_table_alloc(struct mm_struct *mm)
210 page = alloc_page(GFP_KERNEL); 210 page = alloc_page(GFP_KERNEL);
211 if (!page) 211 if (!page)
212 return NULL; 212 return NULL;
213 if (!pgtable_page_ctor(page)) { 213 if (!pgtable_pte_page_ctor(page)) {
214 __free_page(page); 214 __free_page(page);
215 return NULL; 215 return NULL;
216 } 216 }
@@ -256,7 +256,7 @@ void page_table_free(struct mm_struct *mm, unsigned long *table)
256 atomic_xor_bits(&page->_refcount, 3U << 24); 256 atomic_xor_bits(&page->_refcount, 3U << 24);
257 } 257 }
258 258
259 pgtable_page_dtor(page); 259 pgtable_pte_page_dtor(page);
260 __free_page(page); 260 __free_page(page);
261} 261}
262 262
@@ -308,7 +308,7 @@ void __tlb_remove_table(void *_table)
308 case 3: /* 4K page table with pgstes */ 308 case 3: /* 4K page table with pgstes */
309 if (mask & 3) 309 if (mask & 3)
310 atomic_xor_bits(&page->_refcount, 3 << 24); 310 atomic_xor_bits(&page->_refcount, 3 << 24);
311 pgtable_page_dtor(page); 311 pgtable_pte_page_dtor(page);
312 __free_page(page); 312 __free_page(page);
313 break; 313 break;
314 } 314 }
diff --git a/arch/sh/include/asm/pgalloc.h b/arch/sh/include/asm/pgalloc.h
index 8c6341a4d807..22d968bfe9bb 100644
--- a/arch/sh/include/asm/pgalloc.h
+++ b/arch/sh/include/asm/pgalloc.h
@@ -29,7 +29,7 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
29 29
30#define __pte_free_tlb(tlb,pte,addr) \ 30#define __pte_free_tlb(tlb,pte,addr) \
31do { \ 31do { \
32 pgtable_page_dtor(pte); \ 32 pgtable_pte_page_dtor(pte); \
33 tlb_remove_page((tlb), (pte)); \ 33 tlb_remove_page((tlb), (pte)); \
34} while (0) 34} while (0)
35 35
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 4b099dd7a767..e6d91819da92 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -2903,7 +2903,7 @@ pgtable_t pte_alloc_one(struct mm_struct *mm)
2903 struct page *page = alloc_page(GFP_KERNEL | __GFP_ZERO); 2903 struct page *page = alloc_page(GFP_KERNEL | __GFP_ZERO);
2904 if (!page) 2904 if (!page)
2905 return NULL; 2905 return NULL;
2906 if (!pgtable_page_ctor(page)) { 2906 if (!pgtable_pte_page_ctor(page)) {
2907 free_unref_page(page); 2907 free_unref_page(page);
2908 return NULL; 2908 return NULL;
2909 } 2909 }
@@ -2919,7 +2919,7 @@ static void __pte_free(pgtable_t pte)
2919{ 2919{
2920 struct page *page = virt_to_page(pte); 2920 struct page *page = virt_to_page(pte);
2921 2921
2922 pgtable_page_dtor(page); 2922 pgtable_pte_page_dtor(page);
2923 __free_page(page); 2923 __free_page(page);
2924} 2924}
2925 2925
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index aaebbc00d262..cc3ad64479ac 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -378,7 +378,7 @@ pgtable_t pte_alloc_one(struct mm_struct *mm)
378 if ((pte = (unsigned long)pte_alloc_one_kernel(mm)) == 0) 378 if ((pte = (unsigned long)pte_alloc_one_kernel(mm)) == 0)
379 return NULL; 379 return NULL;
380 page = pfn_to_page(__nocache_pa(pte) >> PAGE_SHIFT); 380 page = pfn_to_page(__nocache_pa(pte) >> PAGE_SHIFT);
381 if (!pgtable_page_ctor(page)) { 381 if (!pgtable_pte_page_ctor(page)) {
382 __free_page(page); 382 __free_page(page);
383 return NULL; 383 return NULL;
384 } 384 }
@@ -389,7 +389,7 @@ void pte_free(struct mm_struct *mm, pgtable_t pte)
389{ 389{
390 unsigned long p; 390 unsigned long p;
391 391
392 pgtable_page_dtor(pte); 392 pgtable_pte_page_dtor(pte);
393 p = (unsigned long)page_address(pte); /* Cached address (for test) */ 393 p = (unsigned long)page_address(pte); /* Cached address (for test) */
394 if (p == 0) 394 if (p == 0)
395 BUG(); 395 BUG();
diff --git a/arch/um/include/asm/pgalloc.h b/arch/um/include/asm/pgalloc.h
index 446e0c0f4018..881e76da1938 100644
--- a/arch/um/include/asm/pgalloc.h
+++ b/arch/um/include/asm/pgalloc.h
@@ -29,7 +29,7 @@ extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
29 29
30#define __pte_free_tlb(tlb,pte, address) \ 30#define __pte_free_tlb(tlb,pte, address) \
31do { \ 31do { \
32 pgtable_page_dtor(pte); \ 32 pgtable_pte_page_dtor(pte); \
33 tlb_remove_page((tlb),(pte)); \ 33 tlb_remove_page((tlb),(pte)); \
34} while (0) 34} while (0)
35 35
diff --git a/arch/unicore32/include/asm/tlb.h b/arch/unicore32/include/asm/tlb.h
index 10d2356bfddd..4663d8cc80ef 100644
--- a/arch/unicore32/include/asm/tlb.h
+++ b/arch/unicore32/include/asm/tlb.h
@@ -15,7 +15,7 @@
15 15
16#define __pte_free_tlb(tlb, pte, addr) \ 16#define __pte_free_tlb(tlb, pte, addr) \
17 do { \ 17 do { \
18 pgtable_page_dtor(pte); \ 18 pgtable_pte_page_dtor(pte); \
19 tlb_remove_page((tlb), (pte)); \ 19 tlb_remove_page((tlb), (pte)); \
20 } while (0) 20 } while (0)
21 21
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
index 463940faf52f..3e4b9035bb9a 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -45,7 +45,7 @@ early_param("userpte", setup_userpte);
45 45
46void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte) 46void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte)
47{ 47{
48 pgtable_page_dtor(pte); 48 pgtable_pte_page_dtor(pte);
49 paravirt_release_pte(page_to_pfn(pte)); 49 paravirt_release_pte(page_to_pfn(pte));
50 paravirt_tlb_remove_table(tlb, pte); 50 paravirt_tlb_remove_table(tlb, pte);
51} 51}
diff --git a/arch/xtensa/include/asm/pgalloc.h b/arch/xtensa/include/asm/pgalloc.h
index dd744aa450fa..1d38f0e755ba 100644
--- a/arch/xtensa/include/asm/pgalloc.h
+++ b/arch/xtensa/include/asm/pgalloc.h
@@ -55,7 +55,7 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
55 if (!pte) 55 if (!pte)
56 return NULL; 56 return NULL;
57 page = virt_to_page(pte); 57 page = virt_to_page(pte);
58 if (!pgtable_page_ctor(page)) { 58 if (!pgtable_pte_page_ctor(page)) {
59 __free_page(page); 59 __free_page(page);
60 return NULL; 60 return NULL;
61 } 61 }
@@ -69,7 +69,7 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
69 69
70static inline void pte_free(struct mm_struct *mm, pgtable_t pte) 70static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
71{ 71{
72 pgtable_page_dtor(pte); 72 pgtable_pte_page_dtor(pte);
73 __free_page(pte); 73 __free_page(pte);
74} 74}
75#define pmd_pgtable(pmd) pmd_page(pmd) 75#define pmd_pgtable(pmd) pmd_page(pmd)
diff --git a/include/asm-generic/pgalloc.h b/include/asm-generic/pgalloc.h
index 6f8cc06ee44e..73f7421413cb 100644
--- a/include/asm-generic/pgalloc.h
+++ b/include/asm-generic/pgalloc.h
@@ -49,7 +49,7 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
49 * @mm: the mm_struct of the current context 49 * @mm: the mm_struct of the current context
50 * @gfp: GFP flags to use for the allocation 50 * @gfp: GFP flags to use for the allocation
51 * 51 *
52 * Allocates a page and runs the pgtable_page_ctor(). 52 * Allocates a page and runs the pgtable_pte_page_ctor().
53 * 53 *
54 * This function is intended for architectures that need 54 * This function is intended for architectures that need
55 * anything beyond simple page allocation or must have custom GFP flags. 55 * 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)
63 pte = alloc_page(gfp); 63 pte = alloc_page(gfp);
64 if (!pte) 64 if (!pte)
65 return NULL; 65 return NULL;
66 if (!pgtable_page_ctor(pte)) { 66 if (!pgtable_pte_page_ctor(pte)) {
67 __free_page(pte); 67 __free_page(pte);
68 return NULL; 68 return NULL;
69 } 69 }
@@ -76,7 +76,7 @@ static inline pgtable_t __pte_alloc_one(struct mm_struct *mm, gfp_t gfp)
76 * pte_alloc_one - allocate a page for PTE-level user page table 76 * pte_alloc_one - allocate a page for PTE-level user page table
77 * @mm: the mm_struct of the current context 77 * @mm: the mm_struct of the current context
78 * 78 *
79 * Allocates a page and runs the pgtable_page_ctor(). 79 * Allocates a page and runs the pgtable_pte_page_ctor().
80 * 80 *
81 * Return: `struct page` initialized as page table or %NULL on error 81 * Return: `struct page` initialized as page table or %NULL on error
82 */ 82 */
@@ -98,7 +98,7 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
98 */ 98 */
99static inline void pte_free(struct mm_struct *mm, struct page *pte_page) 99static inline void pte_free(struct mm_struct *mm, struct page *pte_page)
100{ 100{
101 pgtable_page_dtor(pte_page); 101 pgtable_pte_page_dtor(pte_page);
102 __free_page(pte_page); 102 __free_page(pte_page);
103} 103}
104 104
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 294a67b94147..cc292273e6ba 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1949,7 +1949,7 @@ static inline void pgtable_init(void)
1949 pgtable_cache_init(); 1949 pgtable_cache_init();
1950} 1950}
1951 1951
1952static inline bool pgtable_page_ctor(struct page *page) 1952static inline bool pgtable_pte_page_ctor(struct page *page)
1953{ 1953{
1954 if (!ptlock_init(page)) 1954 if (!ptlock_init(page))
1955 return false; 1955 return false;
@@ -1958,7 +1958,7 @@ static inline bool pgtable_page_ctor(struct page *page)
1958 return true; 1958 return true;
1959} 1959}
1960 1960
1961static inline void pgtable_page_dtor(struct page *page) 1961static inline void pgtable_pte_page_dtor(struct page *page)
1962{ 1962{
1963 ptlock_free(page); 1963 ptlock_free(page);
1964 __ClearPageTable(page); 1964 __ClearPageTable(page);