asm-generic: pgalloc: provide generic pmd_alloc_one() and pmd_free_one()
For most architectures that support >2 levels of page tables, pmd_alloc_one() is a wrapper for __get_free_pages(), sometimes with __GFP_ZERO and sometimes followed by memset(0) instead. More elaborate versions on arm64 and x86 account memory for the user page tables and call to pgtable_pmd_page_ctor() as the part of PMD page initialization. Move the arm64 version to include/asm-generic/pgalloc.h and use the generic version on several architectures. The pgtable_pmd_page_ctor() is a NOP when ARCH_ENABLE_SPLIT_PMD_PTLOCK is not enabled, so there is no functional change for most architectures except of the addition of __GFP_ACCOUNT for allocation of user page tables. The pmd_free() is a wrapper for free_page() in all the cases, so no functional change here. Signed-off-by:Mike Rapoport <rppt@linux.ibm.com> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Reviewed-by:
Pekka Enberg <penberg@kernel.org> Cc: Matthew Wilcox <willy@infradead.org> Cc: Abdul Haleem <abdhalee@linux.vnet.ibm.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Christophe Leroy <christophe.leroy@csgroup.eu> Cc: Joerg Roedel <joro@8bytes.org> Cc: Joerg Roedel <jroedel@suse.de> Cc: Max Filippov <jcmvbkbc@gmail.com> Cc: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com> Cc: Stafford Horne <shorne@gmail.com> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Link: http://lkml.kernel.org/r/20200627143453.31835-5-rppt@kernel.org Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
Showing
- arch/alpha/include/asm/pgalloc.h 1 addition, 14 deletionsarch/alpha/include/asm/pgalloc.h
- arch/arm/include/asm/pgalloc.h 0 additions, 11 deletionsarch/arm/include/asm/pgalloc.h
- arch/arm64/include/asm/pgalloc.h 1 addition, 26 deletionsarch/arm64/include/asm/pgalloc.h
- arch/ia64/include/asm/pgalloc.h 0 additions, 10 deletionsarch/ia64/include/asm/pgalloc.h
- arch/mips/include/asm/pgalloc.h 2 additions, 6 deletionsarch/mips/include/asm/pgalloc.h
- arch/parisc/include/asm/pgalloc.h 2 additions, 9 deletionsarch/parisc/include/asm/pgalloc.h
- arch/riscv/include/asm/pgalloc.h 1 addition, 12 deletionsarch/riscv/include/asm/pgalloc.h
- arch/sh/include/asm/pgalloc.h 3 additions, 0 deletionsarch/sh/include/asm/pgalloc.h
- arch/um/include/asm/pgalloc.h 1 addition, 7 deletionsarch/um/include/asm/pgalloc.h
- arch/um/include/asm/pgtable-3level.h 0 additions, 3 deletionsarch/um/include/asm/pgtable-3level.h
- arch/um/kernel/mem.c 0 additions, 12 deletionsarch/um/kernel/mem.c
- arch/x86/include/asm/pgalloc.h 1 addition, 25 deletionsarch/x86/include/asm/pgalloc.h
- include/asm-generic/pgalloc.h 43 additions, 0 deletionsinclude/asm-generic/pgalloc.h
Loading
Please register or sign in to comment