Skip to content

Commit

Permalink
powerpc/mm: refactor pgd_alloc() and pgd_free() on nohash
Browse files Browse the repository at this point in the history
pgd_alloc() and pgd_free() are identical on nohash 32 and 64.

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
Christophe Leroy authored and Michael Ellerman committed May 2, 2019
1 parent 8a2cc87 commit 0692391
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
11 changes: 0 additions & 11 deletions arch/powerpc/include/asm/nohash/32/pgalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@
#include <linux/threads.h>
#include <linux/slab.h>

static inline pgd_t *pgd_alloc(struct mm_struct *mm)
{
return kmem_cache_alloc(PGT_CACHE(PGD_INDEX_SIZE),
pgtable_gfp_flags(mm, GFP_KERNEL));
}

static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
{
kmem_cache_free(PGT_CACHE(PGD_INDEX_SIZE), pgd);
}

/*
* We don't have any real pmd's, and this code never triggers because
* the pgd will always be present..
Expand Down
11 changes: 0 additions & 11 deletions arch/powerpc/include/asm/nohash/64/pgalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@ struct vmemmap_backing {
};
extern struct vmemmap_backing *vmemmap_list;

static inline pgd_t *pgd_alloc(struct mm_struct *mm)
{
return kmem_cache_alloc(PGT_CACHE(PGD_INDEX_SIZE),
pgtable_gfp_flags(mm, GFP_KERNEL));
}

static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
{
kmem_cache_free(PGT_CACHE(PGD_INDEX_SIZE), pgd);
}

#define pgd_populate(MM, PGD, PUD) pgd_set(PGD, (unsigned long)PUD)

static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
Expand Down
12 changes: 12 additions & 0 deletions arch/powerpc/include/asm/nohash/pgalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#define _ASM_POWERPC_NOHASH_PGALLOC_H

#include <linux/mm.h>
#include <linux/slab.h>

extern void tlb_remove_table(struct mmu_gather *tlb, void *table);
#ifdef CONFIG_PPC64
Expand All @@ -16,6 +17,17 @@ static inline void tlb_flush_pgtable(struct mmu_gather *tlb,
}
#endif /* !CONFIG_PPC_BOOK3E */

static inline pgd_t *pgd_alloc(struct mm_struct *mm)
{
return kmem_cache_alloc(PGT_CACHE(PGD_INDEX_SIZE),
pgtable_gfp_flags(mm, GFP_KERNEL));
}

static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
{
kmem_cache_free(PGT_CACHE(PGD_INDEX_SIZE), pgd);
}

#ifdef CONFIG_PPC64
#include <asm/nohash/64/pgalloc.h>
#else
Expand Down

0 comments on commit 0692391

Please sign in to comment.