summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Rapoport <rppt@linux.ibm.com>2019-04-30 10:27:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-21 12:53:00 -0400
commit618381f09cc15592bf3afe846c6a94e9bfcd9ce4 (patch)
tree45d58fa19015bd5c9174aab323facdd0843d548b
parentbec5545edef658f81cd9721dbe8fbebeb3c7534d (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.h34
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
16extern unsigned long long kmap_generation; 18extern 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
49static 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 */
64static 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
70static inline void pte_free(struct mm_struct *mm, struct page *pte)
71{
72 pgtable_page_dtor(pte);
73 __free_page(pte);
74}
75
76static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
77{
78 free_page((unsigned long)pte);
79}
80
81static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, 51static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
82 pgtable_t pte) 52 pgtable_t pte)
83{ 53{