summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Rapoport <rppt@linux.ibm.com>2019-09-23 18:35:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-09-24 18:54:09 -0400
commit6fb12766f7fcd7934b09fbfbd32a725cc2febf96 (patch)
tree730333a748b2c463aacc9f3fe487a1f6635817f2
parent013199211c8bfe9cad9312f5083f0d5a576cf74a (diff)
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>
-rw-r--r--arch/sh/include/asm/pgalloc.h34
1 files changed, 1 insertions, 33 deletions
diff --git a/arch/sh/include/asm/pgalloc.h b/arch/sh/include/asm/pgalloc.h
index 9e15054858b4..8c6341a4d807 100644
--- a/arch/sh/include/asm/pgalloc.h
+++ b/arch/sh/include/asm/pgalloc.h
@@ -3,6 +3,7 @@
3#define __ASM_SH_PGALLOC_H 3#define __ASM_SH_PGALLOC_H
4 4
5#include <asm/page.h> 5#include <asm/page.h>
6#include <asm-generic/pgalloc.h>
6 7
7extern pgd_t *pgd_alloc(struct mm_struct *); 8extern pgd_t *pgd_alloc(struct mm_struct *);
8extern void pgd_free(struct mm_struct *mm, pgd_t *pgd); 9extern 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,
26} 27}
27#define pmd_pgtable(pmd) pmd_page(pmd) 28#define pmd_pgtable(pmd) pmd_page(pmd)
28 29
29/*
30 * Allocate and free page tables.
31 */
32static 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
37static 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
51static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
52{
53 free_page((unsigned long)pte);
54}
55
56static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
57{
58 pgtable_page_dtor(pte);
59 __free_page(pte);
60}
61
62#define __pte_free_tlb(tlb,pte,addr) \ 30#define __pte_free_tlb(tlb,pte,addr) \
63do { \ 31do { \
64 pgtable_page_dtor(pte); \ 32 pgtable_page_dtor(pte); \