Skip to content

Commit

Permalink
hexagon: switch to generic version of pte allocation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mike Rapoport authored and Linus Torvalds committed Jul 21, 2019
1 parent bec5545 commit 618381f
Showing 1 changed file with 2 additions and 32 deletions.
34 changes: 2 additions & 32 deletions arch/hexagon/include/asm/pgalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <asm/mem-layout.h>
#include <asm/atomic.h>

#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */

#define check_pgt_cache() do {} while (0)

extern unsigned long long kmap_generation;
Expand Down Expand Up @@ -46,38 +48,6 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
free_page((unsigned long) pgd);
}

static inline struct page *pte_alloc_one(struct mm_struct *mm)
{
struct page *pte;

pte = alloc_page(GFP_KERNEL | __GFP_ZERO);
if (!pte)
return NULL;
if (!pgtable_page_ctor(pte)) {
__free_page(pte);
return NULL;
}
return pte;
}

/* _kernel variant gets to use a different allocator */
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm)
{
gfp_t flags = GFP_KERNEL | __GFP_ZERO;
return (pte_t *) __get_free_page(flags);
}

static inline void pte_free(struct mm_struct *mm, struct page *pte)
{
pgtable_page_dtor(pte);
__free_page(pte);
}

static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
{
free_page((unsigned long)pte);
}

static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
pgtable_t pte)
{
Expand Down

0 comments on commit 618381f

Please sign in to comment.