diff options
author | Paul Mundt <lethal@linux-sh.org> | 2006-09-27 00:11:57 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2006-09-27 00:11:57 -0400 |
commit | 3f787fe2e077ecfe43ad9ad56f12a8e21cffafc3 (patch) | |
tree | 69c3abcc67137503f17b8535b854578c3aac394b /arch/sh | |
parent | 4bcac20a7a01d49dffb5e88a8140efa34927c383 (diff) |
sh: hugetlb updates.
For some of the larger sizes we permitted spanning pages
across several PTEs, but this turned out to not be generally
useful. This reverts the sh hugetlbpage interface to something
more sensible using huge pages at single PTE granularity.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r-- | arch/sh/mm/hugetlbpage.c | 52 |
1 files changed, 16 insertions, 36 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, |