Commit f32848e16939e1407ad3413f7faa3e0a8ad802eb
Committed by
Linus Torvalds
1 parent
d1b46fe50c
um: switch to generic version of pte allocation
um allocates PTE pages with __get_free_page() and uses GFP_KERNEL | __GFP_ZERO for the allocations. Switch it to the generic version that does exactly the same thing for the kernel page tables and adds __GFP_ACCOUNT for the user PTEs. The pte_free() and pte_free_kernel() versions are identical to the generic ones and can be simply dropped. Link: http://lkml.kernel.org/r/1557296232-15361-14-git-send-email-rppt@linux.ibm.com Signed-off-by: Mike Rapoport <rppt@linux.ibm.com> Reviewed-by: Anton Ivanov <anton.ivanov@cambridgegreys.com> Acked-by: Anton Ivanov <anton.ivanov@cambridgegreys.com> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: Anshuman Khandual <anshuman.khandual@arm.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Greentime Hu <green.hu@gmail.com> Cc: Guan Xuetao <gxt@pku.edu.cn> Cc: Guo Ren <guoren@kernel.org> Cc: Guo Ren <ren_guo@c-sky.com> Cc: Helge Deller <deller@gmx.de> Cc: Ley Foon Tan <lftan@altera.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Matt Turner <mattst88@gmail.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Michal Hocko <mhocko@suse.com> Cc: Palmer Dabbelt <palmer@sifive.com> Cc: Paul Burton <paul.burton@mips.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Richard Kuo <rkuo@codeaurora.org> Cc: Richard Weinberger <richard@nod.at> Cc: Russell King <linux@armlinux.org.uk> Cc: Sam Creasey <sammy@sammy.net> Cc: Vincent Chen <deanbo422@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 2 changed files with 2 additions and 36 deletions Side-by-side Diff
arch/um/include/asm/pgalloc.h
... | ... | @@ -10,6 +10,8 @@ |
10 | 10 | |
11 | 11 | #include <linux/mm.h> |
12 | 12 | |
13 | +#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */ | |
14 | + | |
13 | 15 | #define pmd_populate_kernel(mm, pmd, pte) \ |
14 | 16 | set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte))) |
15 | 17 | |
... | ... | @@ -24,20 +26,6 @@ |
24 | 26 | */ |
25 | 27 | extern pgd_t *pgd_alloc(struct mm_struct *); |
26 | 28 | extern void pgd_free(struct mm_struct *mm, pgd_t *pgd); |
27 | - | |
28 | -extern pte_t *pte_alloc_one_kernel(struct mm_struct *); | |
29 | -extern pgtable_t pte_alloc_one(struct mm_struct *); | |
30 | - | |
31 | -static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | |
32 | -{ | |
33 | - free_page((unsigned long) pte); | |
34 | -} | |
35 | - | |
36 | -static inline void pte_free(struct mm_struct *mm, pgtable_t pte) | |
37 | -{ | |
38 | - pgtable_page_dtor(pte); | |
39 | - __free_page(pte); | |
40 | -} | |
41 | 29 | |
42 | 30 | #define __pte_free_tlb(tlb,pte, address) \ |
43 | 31 | do { \ |
arch/um/kernel/mem.c
... | ... | @@ -208,28 +208,6 @@ |
208 | 208 | free_page((unsigned long) pgd); |
209 | 209 | } |
210 | 210 | |
211 | -pte_t *pte_alloc_one_kernel(struct mm_struct *mm) | |
212 | -{ | |
213 | - pte_t *pte; | |
214 | - | |
215 | - pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO); | |
216 | - return pte; | |
217 | -} | |
218 | - | |
219 | -pgtable_t pte_alloc_one(struct mm_struct *mm) | |
220 | -{ | |
221 | - struct page *pte; | |
222 | - | |
223 | - pte = alloc_page(GFP_KERNEL|__GFP_ZERO); | |
224 | - if (!pte) | |
225 | - return NULL; | |
226 | - if (!pgtable_page_ctor(pte)) { | |
227 | - __free_page(pte); | |
228 | - return NULL; | |
229 | - } | |
230 | - return pte; | |
231 | -} | |
232 | - | |
233 | 211 | #ifdef CONFIG_3_LEVEL_PGTABLES |
234 | 212 | pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) |
235 | 213 | { |