diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/frv/mm/pgalloc.c | 8 | ||||
-rw-r--r-- | arch/powerpc/mm/pgtable_32.c | 14 | ||||
-rw-r--r-- | arch/ppc/mm/pgtable.c | 9 | ||||
-rw-r--r-- | arch/s390/mm/pgtable.c | 2 | ||||
-rw-r--r-- | arch/sparc/mm/srmmu.c | 10 | ||||
-rw-r--r-- | arch/sparc/mm/sun4c.c | 14 | ||||
-rw-r--r-- | arch/um/kernel/mem.c | 4 | ||||
-rw-r--r-- | arch/x86/mm/pgtable_32.c | 5 |
8 files changed, 45 insertions, 21 deletions
diff --git a/arch/frv/mm/pgalloc.c b/arch/frv/mm/pgalloc.c index 1a2e5c8d03a9..66f616fb4860 100644 --- a/arch/frv/mm/pgalloc.c +++ b/arch/frv/mm/pgalloc.c | |||
@@ -28,7 +28,7 @@ pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) | |||
28 | return pte; | 28 | return pte; |
29 | } | 29 | } |
30 | 30 | ||
31 | struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) | 31 | pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) |
32 | { | 32 | { |
33 | struct page *page; | 33 | struct page *page; |
34 | 34 | ||
@@ -37,9 +37,11 @@ struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) | |||
37 | #else | 37 | #else |
38 | page = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0); | 38 | page = alloc_pages(GFP_KERNEL|__GFP_REPEAT, 0); |
39 | #endif | 39 | #endif |
40 | if (page) | 40 | if (page) { |
41 | clear_highpage(page); | 41 | clear_highpage(page); |
42 | flush_dcache_page(page); | 42 | pgtable_page_ctor(page); |
43 | flush_dcache_page(page); | ||
44 | } | ||
43 | return page; | 45 | return page; |
44 | } | 46 | } |
45 | 47 | ||
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c index f80f90c4d58b..ac3390f81900 100644 --- a/arch/powerpc/mm/pgtable_32.c +++ b/arch/powerpc/mm/pgtable_32.c | |||
@@ -107,19 +107,20 @@ __init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long add | |||
107 | return pte; | 107 | return pte; |
108 | } | 108 | } |
109 | 109 | ||
110 | struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) | 110 | pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) |
111 | { | 111 | { |
112 | struct page *ptepage; | 112 | struct page *ptepage; |
113 | 113 | ||
114 | #ifdef CONFIG_HIGHPTE | 114 | #ifdef CONFIG_HIGHPTE |
115 | gfp_t flags = GFP_KERNEL | __GFP_HIGHMEM | __GFP_REPEAT; | 115 | gfp_t flags = GFP_KERNEL | __GFP_HIGHMEM | __GFP_REPEAT | __GFP_ZERO; |
116 | #else | 116 | #else |
117 | gfp_t flags = GFP_KERNEL | __GFP_REPEAT; | 117 | gfp_t flags = GFP_KERNEL | __GFP_REPEAT | __GFP_ZERO; |
118 | #endif | 118 | #endif |
119 | 119 | ||
120 | ptepage = alloc_pages(flags, 0); | 120 | ptepage = alloc_pages(flags, 0); |
121 | if (ptepage) | 121 | if (!ptepage) |
122 | clear_highpage(ptepage); | 122 | return NULL; |
123 | pgtable_page_ctor(ptepage); | ||
123 | return ptepage; | 124 | return ptepage; |
124 | } | 125 | } |
125 | 126 | ||
@@ -131,11 +132,12 @@ void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | |||
131 | free_page((unsigned long)pte); | 132 | free_page((unsigned long)pte); |
132 | } | 133 | } |
133 | 134 | ||
134 | void pte_free(struct mm_struct *mm, struct page *ptepage) | 135 | void pte_free(struct mm_struct *mm, pgtable_t ptepage) |
135 | { | 136 | { |
136 | #ifdef CONFIG_SMP | 137 | #ifdef CONFIG_SMP |
137 | hash_page_sync(); | 138 | hash_page_sync(); |
138 | #endif | 139 | #endif |
140 | pgtable_page_dtor(ptepage); | ||
139 | __free_page(ptepage); | 141 | __free_page(ptepage); |
140 | } | 142 | } |
141 | 143 | ||
diff --git a/arch/ppc/mm/pgtable.c b/arch/ppc/mm/pgtable.c index 409fcaa4994a..03a79bff1271 100644 --- a/arch/ppc/mm/pgtable.c +++ b/arch/ppc/mm/pgtable.c | |||
@@ -95,7 +95,7 @@ __init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long add | |||
95 | return pte; | 95 | return pte; |
96 | } | 96 | } |
97 | 97 | ||
98 | struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) | 98 | pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) |
99 | { | 99 | { |
100 | struct page *ptepage; | 100 | struct page *ptepage; |
101 | 101 | ||
@@ -106,8 +106,10 @@ struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) | |||
106 | #endif | 106 | #endif |
107 | 107 | ||
108 | ptepage = alloc_pages(flags, 0); | 108 | ptepage = alloc_pages(flags, 0); |
109 | if (ptepage) | 109 | if (ptepage) { |
110 | clear_highpage(ptepage); | 110 | clear_highpage(ptepage); |
111 | pgtable_page_ctor(ptepage); | ||
112 | } | ||
111 | return ptepage; | 113 | return ptepage; |
112 | } | 114 | } |
113 | 115 | ||
@@ -119,11 +121,12 @@ void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | |||
119 | free_page((unsigned long)pte); | 121 | free_page((unsigned long)pte); |
120 | } | 122 | } |
121 | 123 | ||
122 | void pte_free(struct mm_struct *mm, struct page *ptepage) | 124 | void pte_free(struct mm_struct *mm, pgtable_t ptepage) |
123 | { | 125 | { |
124 | #ifdef CONFIG_SMP | 126 | #ifdef CONFIG_SMP |
125 | hash_page_sync(); | 127 | hash_page_sync(); |
126 | #endif | 128 | #endif |
129 | pgtable_page_dtor(ptepage); | ||
127 | __free_page(ptepage); | 130 | __free_page(ptepage); |
128 | } | 131 | } |
129 | 132 | ||
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c index e60e0ae13402..019f518cd5a0 100644 --- a/arch/s390/mm/pgtable.c +++ b/arch/s390/mm/pgtable.c | |||
@@ -78,6 +78,7 @@ unsigned long *page_table_alloc(int noexec) | |||
78 | clear_table(table, _PAGE_TYPE_EMPTY, PAGE_SIZE); | 78 | clear_table(table, _PAGE_TYPE_EMPTY, PAGE_SIZE); |
79 | page->index = (addr_t) table; | 79 | page->index = (addr_t) table; |
80 | } | 80 | } |
81 | pgtable_page_ctor(page); | ||
81 | table = (unsigned long *) page_to_phys(page); | 82 | table = (unsigned long *) page_to_phys(page); |
82 | clear_table(table, _PAGE_TYPE_EMPTY, PAGE_SIZE); | 83 | clear_table(table, _PAGE_TYPE_EMPTY, PAGE_SIZE); |
83 | return table; | 84 | return table; |
@@ -87,6 +88,7 @@ void page_table_free(unsigned long *table) | |||
87 | { | 88 | { |
88 | unsigned long *shadow = get_shadow_pte(table); | 89 | unsigned long *shadow = get_shadow_pte(table); |
89 | 90 | ||
91 | pgtable_page_dtor(virt_to_page(table)); | ||
90 | if (shadow) | 92 | if (shadow) |
91 | free_page((unsigned long) shadow); | 93 | free_page((unsigned long) shadow); |
92 | free_page((unsigned long) table); | 94 | free_page((unsigned long) table); |
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index dc98e3844a0a..23d3291a3e81 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c | |||
@@ -489,14 +489,17 @@ srmmu_pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) | |||
489 | return (pte_t *)srmmu_get_nocache(PTE_SIZE, PTE_SIZE); | 489 | return (pte_t *)srmmu_get_nocache(PTE_SIZE, PTE_SIZE); |
490 | } | 490 | } |
491 | 491 | ||
492 | static struct page * | 492 | static pgtable_t |
493 | srmmu_pte_alloc_one(struct mm_struct *mm, unsigned long address) | 493 | srmmu_pte_alloc_one(struct mm_struct *mm, unsigned long address) |
494 | { | 494 | { |
495 | unsigned long pte; | 495 | unsigned long pte; |
496 | struct page *page; | ||
496 | 497 | ||
497 | if ((pte = (unsigned long)srmmu_pte_alloc_one_kernel(mm, address)) == 0) | 498 | if ((pte = (unsigned long)srmmu_pte_alloc_one_kernel(mm, address)) == 0) |
498 | return NULL; | 499 | return NULL; |
499 | return pfn_to_page( __nocache_pa(pte) >> PAGE_SHIFT ); | 500 | page = pfn_to_page( __nocache_pa(pte) >> PAGE_SHIFT ); |
501 | pgtable_page_ctor(page); | ||
502 | return page; | ||
500 | } | 503 | } |
501 | 504 | ||
502 | static void srmmu_free_pte_fast(pte_t *pte) | 505 | static void srmmu_free_pte_fast(pte_t *pte) |
@@ -504,10 +507,11 @@ static void srmmu_free_pte_fast(pte_t *pte) | |||
504 | srmmu_free_nocache((unsigned long)pte, PTE_SIZE); | 507 | srmmu_free_nocache((unsigned long)pte, PTE_SIZE); |
505 | } | 508 | } |
506 | 509 | ||
507 | static void srmmu_pte_free(struct page *pte) | 510 | static void srmmu_pte_free(pgtable_t pte) |
508 | { | 511 | { |
509 | unsigned long p; | 512 | unsigned long p; |
510 | 513 | ||
514 | pgtable_page_dtor(pte); | ||
511 | p = (unsigned long)page_address(pte); /* Cached address (for test) */ | 515 | p = (unsigned long)page_address(pte); /* Cached address (for test) */ |
512 | if (p == 0) | 516 | if (p == 0) |
513 | BUG(); | 517 | BUG(); |
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c index 0729305f2f59..c0442e8c4b15 100644 --- a/arch/sparc/mm/sun4c.c +++ b/arch/sparc/mm/sun4c.c | |||
@@ -1947,12 +1947,17 @@ static pte_t *sun4c_pte_alloc_one_kernel(struct mm_struct *mm, unsigned long add | |||
1947 | return pte; | 1947 | return pte; |
1948 | } | 1948 | } |
1949 | 1949 | ||
1950 | static struct page *sun4c_pte_alloc_one(struct mm_struct *mm, unsigned long address) | 1950 | static pgtable_t sun4c_pte_alloc_one(struct mm_struct *mm, unsigned long address) |
1951 | { | 1951 | { |
1952 | pte_t *pte = sun4c_pte_alloc_one_kernel(mm, address); | 1952 | pte_t *pte; |
1953 | struct page *page; | ||
1954 | |||
1955 | pte = sun4c_pte_alloc_one_kernel(mm, address); | ||
1953 | if (pte == NULL) | 1956 | if (pte == NULL) |
1954 | return NULL; | 1957 | return NULL; |
1955 | return virt_to_page(pte); | 1958 | page = virt_to_page(pte); |
1959 | pgtable_page_ctor(page); | ||
1960 | return page; | ||
1956 | } | 1961 | } |
1957 | 1962 | ||
1958 | static inline void sun4c_free_pte_fast(pte_t *pte) | 1963 | static inline void sun4c_free_pte_fast(pte_t *pte) |
@@ -1962,8 +1967,9 @@ static inline void sun4c_free_pte_fast(pte_t *pte) | |||
1962 | pgtable_cache_size++; | 1967 | pgtable_cache_size++; |
1963 | } | 1968 | } |
1964 | 1969 | ||
1965 | static void sun4c_pte_free(struct page *pte) | 1970 | static void sun4c_pte_free(pgtable_t pte) |
1966 | { | 1971 | { |
1972 | pgtable_page_dtor(pte); | ||
1967 | sun4c_free_pte_fast(page_address(pte)); | 1973 | sun4c_free_pte_fast(page_address(pte)); |
1968 | } | 1974 | } |
1969 | 1975 | ||
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c index d872fdce1d7e..2627ce82e918 100644 --- a/arch/um/kernel/mem.c +++ b/arch/um/kernel/mem.c | |||
@@ -354,11 +354,13 @@ pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) | |||
354 | return pte; | 354 | return pte; |
355 | } | 355 | } |
356 | 356 | ||
357 | struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) | 357 | pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) |
358 | { | 358 | { |
359 | struct page *pte; | 359 | struct page *pte; |
360 | 360 | ||
361 | pte = alloc_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); | 361 | pte = alloc_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); |
362 | if (pte) | ||
363 | pgtable_page_ctor(pte); | ||
362 | return pte; | 364 | return pte; |
363 | } | 365 | } |
364 | 366 | ||
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c index 6c1914622a88..73aba7125203 100644 --- a/arch/x86/mm/pgtable_32.c +++ b/arch/x86/mm/pgtable_32.c | |||
@@ -183,7 +183,7 @@ pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) | |||
183 | return (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); | 183 | return (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO); |
184 | } | 184 | } |
185 | 185 | ||
186 | struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) | 186 | pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) |
187 | { | 187 | { |
188 | struct page *pte; | 188 | struct page *pte; |
189 | 189 | ||
@@ -192,6 +192,8 @@ struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) | |||
192 | #else | 192 | #else |
193 | pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); | 193 | pte = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0); |
194 | #endif | 194 | #endif |
195 | if (pte) | ||
196 | pgtable_page_ctor(pte); | ||
195 | return pte; | 197 | return pte; |
196 | } | 198 | } |
197 | 199 | ||
@@ -365,6 +367,7 @@ void check_pgt_cache(void) | |||
365 | 367 | ||
366 | void __pte_free_tlb(struct mmu_gather *tlb, struct page *pte) | 368 | void __pte_free_tlb(struct mmu_gather *tlb, struct page *pte) |
367 | { | 369 | { |
370 | pgtable_page_dtor(pte); | ||
368 | paravirt_release_pt(page_to_pfn(pte)); | 371 | paravirt_release_pt(page_to_pfn(pte)); |
369 | tlb_remove_page(tlb, pte); | 372 | tlb_remove_page(tlb, pte); |
370 | } | 373 | } |