Skip to content

Commit 618381f

Browse files
rppttorvalds
authored andcommitted
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 <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent bec5545 commit 618381f

File tree

1 file changed

+2
-32
lines changed

1 file changed

+2
-32
lines changed

arch/hexagon/include/asm/pgalloc.h

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <asm/mem-layout.h>
1212
#include <asm/atomic.h>
1313

14+
#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */
15+
1416
#define check_pgt_cache() do {} while (0)
1517

1618
extern unsigned long long kmap_generation;
@@ -46,38 +48,6 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
4648
free_page((unsigned long) pgd);
4749
}
4850

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-
8151
static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
8252
pgtable_t pte)
8353
{

0 commit comments

Comments
 (0)