diff options
author | Mike Rapoport <rppt@linux.ibm.com> | 2019-04-30 10:27:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-21 12:53:00 -0400 |
commit | 618381f09cc15592bf3afe846c6a94e9bfcd9ce4 (patch) | |
tree | 45d58fa19015bd5c9174aab323facdd0843d548b | |
parent | bec5545edef658f81cd9721dbe8fbebeb3c7534d (diff) |
hexagon: switch to generic version of pte allocation
The hexagon implementation pte_alloc_one(), pte_alloc_one_kernel(),
pte_free_kernel() and pte_free() is identical to the generic except of
lack of __GFP_ACCOUNT for the user PTEs allocation.
Switch hexagon to use generic version of these functions.
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/hexagon/include/asm/pgalloc.h | 34 |
1 files changed, 2 insertions, 32 deletions
diff --git a/arch/hexagon/include/asm/pgalloc.h b/arch/hexagon/include/asm/pgalloc.h index 3c9e1bd9a3e9..d6544dc71258 100644 --- a/arch/hexagon/include/asm/pgalloc.h +++ b/arch/hexagon/include/asm/pgalloc.h | |||
@@ -11,6 +11,8 @@ | |||
11 | #include <asm/mem-layout.h> | 11 | #include <asm/mem-layout.h> |
12 | #include <asm/atomic.h> | 12 | #include <asm/atomic.h> |
13 | 13 | ||
14 | #include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */ | ||
15 | |||
14 | #define check_pgt_cache() do {} while (0) | 16 | #define check_pgt_cache() do {} while (0) |
15 | 17 | ||
16 | extern unsigned long long kmap_generation; | 18 | extern unsigned long long kmap_generation; |
@@ -46,38 +48,6 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) | |||
46 | free_page((unsigned long) pgd); | 48 | free_page((unsigned long) pgd); |
47 | } | 49 | } |
48 | 50 | ||
49 | static inline struct page *pte_alloc_one(struct mm_struct *mm) | ||
50 | { | ||
51 | struct page *pte; | ||
52 | |||
53 | pte = alloc_page(GFP_KERNEL | __GFP_ZERO); | ||
54 | if (!pte) | ||
55 | return NULL; | ||
56 | if (!pgtable_page_ctor(pte)) { | ||
57 | __free_page(pte); | ||
58 | return NULL; | ||
59 | } | ||
60 | return pte; | ||
61 | } | ||
62 | |||
63 | /* _kernel variant gets to use a different allocator */ | ||
64 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) | ||
65 | { | ||
66 | gfp_t flags = GFP_KERNEL | __GFP_ZERO; | ||
67 | return (pte_t *) __get_free_page(flags); | ||
68 | } | ||
69 | |||
70 | static inline void pte_free(struct mm_struct *mm, struct page *pte) | ||
71 | { | ||
72 | pgtable_page_dtor(pte); | ||
73 | __free_page(pte); | ||
74 | } | ||
75 | |||
76 | static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) | ||
77 | { | ||
78 | free_page((unsigned long)pte); | ||
79 | } | ||
80 | |||
81 | static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, | 51 | static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, |
82 | pgtable_t pte) | 52 | pgtable_t pte) |
83 | { | 53 | { |