diff options
author | Mike Rapoport <rppt@linux.ibm.com> | 2019-07-11 23:58:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-12 14:05:45 -0400 |
commit | 14c0a39c9af9a25e0f94f9be89431c2debb34f2c (patch) | |
tree | 323b04cb5780eb1f7458a8ee61500bc99f593c70 /arch/m68k | |
parent | bd5ff066514c2dcffd443cfaa55580db0f19caf8 (diff) |
m68k: sun3: switch to generic version of pte allocation
The sun3 MMU variant of m68k uses GFP_KERNEL to allocate a PTE page and
then memset(0) or clear_highpage() to clear it.
This is equivalent to allocating the page with GFP_KERNEL | __GFP_ZERO,
which allows replacing sun3 implementation of pte_alloc_one() and
pte_alloc_one_kernel() with the generic ones.
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-8-git-send-email-rppt@linux.ibm.com
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.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>
Diffstat (limited to 'arch/m68k')
-rw-r--r-- | arch/m68k/include/asm/sun3_pgalloc.h | 41 |
1 files changed, 2 insertions, 39 deletions
diff --git a/arch/m68k/include/asm/sun3_pgalloc.h b/arch/m68k/include/asm/sun3_pgalloc.h index 1456c5eecbd9..1a8ddbd0d23c 100644 --- a/arch/m68k/include/asm/sun3_pgalloc.h +++ b/arch/m68k/include/asm/sun3_pgalloc.h | |||
@@ -13,55 +13,18 @@ | |||
13 | 13 | ||
14 | #include <asm/tlb.h> | 14 | #include <asm/tlb.h> |
15 | 15 | ||
16 | #include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */ | ||
17 | |||
16 | extern const char bad_pmd_string[]; | 18 | extern const char bad_pmd_string[]; |
17 | 19 | ||
18 | #define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); }) | 20 | #define pmd_alloc_one(mm,address) ({ BUG(); ((pmd_t *)2); }) |
19 | 21 | ||
20 | |||
21 | static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | ||
22 | { | ||
23 | free_page((unsigned long) pte); | ||
24 | } | ||
25 | |||
26 | static inline void pte_free(struct mm_struct *mm, pgtable_t page) | ||
27 | { | ||
28 | pgtable_page_dtor(page); | ||
29 | __free_page(page); | ||
30 | } | ||
31 | |||
32 | #define __pte_free_tlb(tlb,pte,addr) \ | 22 | #define __pte_free_tlb(tlb,pte,addr) \ |
33 | do { \ | 23 | do { \ |
34 | pgtable_page_dtor(pte); \ | 24 | pgtable_page_dtor(pte); \ |
35 | tlb_remove_page((tlb), pte); \ | 25 | tlb_remove_page((tlb), pte); \ |
36 | } while (0) | 26 | } while (0) |
37 | 27 | ||
38 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) | ||
39 | { | ||
40 | unsigned long page = __get_free_page(GFP_KERNEL); | ||
41 | |||
42 | if (!page) | ||
43 | return NULL; | ||
44 | |||
45 | memset((void *)page, 0, PAGE_SIZE); | ||
46 | return (pte_t *) (page); | ||
47 | } | ||
48 | |||
49 | static inline pgtable_t pte_alloc_one(struct mm_struct *mm) | ||
50 | { | ||
51 | struct page *page = alloc_pages(GFP_KERNEL, 0); | ||
52 | |||
53 | if (page == NULL) | ||
54 | return NULL; | ||
55 | |||
56 | clear_highpage(page); | ||
57 | if (!pgtable_page_ctor(page)) { | ||
58 | __free_page(page); | ||
59 | return NULL; | ||
60 | } | ||
61 | return page; | ||
62 | |||
63 | } | ||
64 | |||
65 | static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) | 28 | static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) |
66 | { | 29 | { |
67 | pmd_val(*pmd) = __pa((unsigned long)pte); | 30 | pmd_val(*pmd) = __pa((unsigned long)pte); |