Skip to content

Commit 6fb1276

Browse files
rppttorvalds
authored andcommitted
sh: switch to generic version of pte allocation
The sh 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 sh to use generic version of these functions. Link: http://lkml.kernel.org/r/1565250728-21721-4-git-send-email-rppt@linux.ibm.com Signed-off-by: Mike Rapoport <rppt@linux.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 0131992 commit 6fb1276

1 file changed

Lines changed: 1 addition & 33 deletions

File tree

‎arch/sh/include/asm/pgalloc.h‎

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#define __ASM_SH_PGALLOC_H
44

55
#include <asm/page.h>
6+
#include <asm-generic/pgalloc.h>
67

78
extern pgd_t *pgd_alloc(struct mm_struct *);
89
extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
@@ -26,39 +27,6 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
2627
}
2728
#define pmd_pgtable(pmd) pmd_page(pmd)
2829

29-
/*
30-
* Allocate and free page tables.
31-
*/
32-
static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm)
33-
{
34-
return (pte_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
35-
}
36-
37-
static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
38-
{
39-
struct page *page;
40-
41-
page = alloc_page(GFP_KERNEL | __GFP_ZERO);
42-
if (!page)
43-
return NULL;
44-
if (!pgtable_page_ctor(page)) {
45-
__free_page(page);
46-
return NULL;
47-
}
48-
return page;
49-
}
50-
51-
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
52-
{
53-
free_page((unsigned long)pte);
54-
}
55-
56-
static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
57-
{
58-
pgtable_page_dtor(pte);
59-
__free_page(pte);
60-
}
61-
6230
#define __pte_free_tlb(tlb,pte,addr) \
6331
do { \
6432
pgtable_page_dtor(pte); \

0 commit comments

Comments
 (0)