diff options
-rw-r--r-- | arch/sh/mm/hugetlbpage.c | 52 | ||||
-rw-r--r-- | include/asm-sh/page.h | 1 |
2 files changed, 16 insertions, 37 deletions
diff --git a/arch/sh/mm/hugetlbpage.c b/arch/sh/mm/hugetlbpage.c index 2a85bc15a412..329059d6b54a 100644 --- a/arch/sh/mm/hugetlbpage.c +++ b/arch/sh/mm/hugetlbpage.c | |||
@@ -26,61 +26,41 @@ | |||
26 | pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr) | 26 | pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr) |
27 | { | 27 | { |
28 | pgd_t *pgd; | 28 | pgd_t *pgd; |
29 | pud_t *pud; | ||
29 | pmd_t *pmd; | 30 | pmd_t *pmd; |
30 | pte_t *pte = NULL; | 31 | pte_t *pte = NULL; |
31 | 32 | ||
32 | pgd = pgd_offset(mm, addr); | 33 | pgd = pgd_offset(mm, addr); |
33 | if (pgd) { | 34 | if (pgd) { |
34 | pmd = pmd_alloc(mm, pgd, addr); | 35 | pud = pud_alloc(mm, pgd, addr); |
35 | if (pmd) | 36 | if (pud) { |
36 | pte = pte_alloc_map(mm, pmd, addr); | 37 | pmd = pmd_alloc(mm, pud, addr); |
38 | if (pmd) | ||
39 | pte = pte_alloc_map(mm, pmd, addr); | ||
40 | } | ||
37 | } | 41 | } |
42 | |||
38 | return pte; | 43 | return pte; |
39 | } | 44 | } |
40 | 45 | ||
41 | pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) | 46 | pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) |
42 | { | 47 | { |
43 | pgd_t *pgd; | 48 | pgd_t *pgd; |
49 | pud_t *pud; | ||
44 | pmd_t *pmd; | 50 | pmd_t *pmd; |
45 | pte_t *pte = NULL; | 51 | pte_t *pte = NULL; |
46 | 52 | ||
47 | pgd = pgd_offset(mm, addr); | 53 | pgd = pgd_offset(mm, addr); |
48 | if (pgd) { | 54 | if (pgd) { |
49 | pmd = pmd_offset(pgd, addr); | 55 | pud = pud_offset(pgd, addr); |
50 | if (pmd) | 56 | if (pud) { |
51 | pte = pte_offset_map(pmd, addr); | 57 | pmd = pmd_offset(pud, addr); |
52 | } | 58 | if (pmd) |
53 | return pte; | 59 | pte = pte_offset_map(pmd, addr); |
54 | } | 60 | } |
55 | |||
56 | void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, | ||
57 | pte_t *ptep, pte_t entry) | ||
58 | { | ||
59 | int i; | ||
60 | |||
61 | for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) { | ||
62 | set_pte_at(mm, addr, ptep, entry); | ||
63 | ptep++; | ||
64 | addr += PAGE_SIZE; | ||
65 | pte_val(entry) += PAGE_SIZE; | ||
66 | } | 61 | } |
67 | } | ||
68 | |||
69 | pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, | ||
70 | pte_t *ptep) | ||
71 | { | ||
72 | pte_t entry; | ||
73 | int i; | ||
74 | |||
75 | entry = *ptep; | ||
76 | 62 | ||
77 | for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) { | 63 | return pte; |
78 | pte_clear(mm, addr, ptep); | ||
79 | addr += PAGE_SIZE; | ||
80 | ptep++; | ||
81 | } | ||
82 | |||
83 | return entry; | ||
84 | } | 64 | } |
85 | 65 | ||
86 | struct page *follow_huge_addr(struct mm_struct *mm, | 66 | struct page *follow_huge_addr(struct mm_struct *mm, |
diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h index 6f7eb8a3aba5..4811d410d123 100644 --- a/include/asm-sh/page.h +++ b/include/asm-sh/page.h | |||
@@ -30,7 +30,6 @@ | |||
30 | #define HPAGE_SIZE (1UL << HPAGE_SHIFT) | 30 | #define HPAGE_SIZE (1UL << HPAGE_SHIFT) |
31 | #define HPAGE_MASK (~(HPAGE_SIZE-1)) | 31 | #define HPAGE_MASK (~(HPAGE_SIZE-1)) |
32 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT) | 32 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT) |
33 | #define ARCH_HAS_SETCLEAR_HUGE_PTE | ||
34 | #endif | 33 | #endif |
35 | 34 | ||
36 | #ifdef __KERNEL__ | 35 | #ifdef __KERNEL__ |