sh: hugetlb updates.
authorPaul Mundt <lethal@linux-sh.org>
Wed, 27 Sep 2006 04:11:57 +0000 (13:11 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Wed, 27 Sep 2006 04:11:57 +0000 (13:11 +0900)
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>
arch/sh/mm/hugetlbpage.c
include/asm-sh/page.h

index 2a85bc15a41238ce2d84e5bf891b63b589bd67ae..329059d6b54a79b2bdfb2eacdb2c4477f5936386 100644 (file)
 pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
 {
        pgd_t *pgd;
+       pud_t *pud;
        pmd_t *pmd;
        pte_t *pte = NULL;
 
        pgd = pgd_offset(mm, addr);
        if (pgd) {
-               pmd = pmd_alloc(mm, pgd, addr);
-               if (pmd)
-                       pte = pte_alloc_map(mm, pmd, addr);
+               pud = pud_alloc(mm, pgd, addr);
+               if (pud) {
+                       pmd = pmd_alloc(mm, pud, addr);
+                       if (pmd)
+                               pte = pte_alloc_map(mm, pmd, addr);
+               }
        }
+
        return pte;
 }
 
 pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
 {
        pgd_t *pgd;
+       pud_t *pud;
        pmd_t *pmd;
        pte_t *pte = NULL;
 
        pgd = pgd_offset(mm, addr);
        if (pgd) {
-               pmd = pmd_offset(pgd, addr);
-               if (pmd)
-                       pte = pte_offset_map(pmd, addr);
-       }
-       return pte;
-}
-
-void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
-                    pte_t *ptep, pte_t entry)
-{
-       int i;
-
-       for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
-               set_pte_at(mm, addr, ptep, entry);
-               ptep++;
-               addr += PAGE_SIZE;
-               pte_val(entry) += PAGE_SIZE;
+               pud = pud_offset(pgd, addr);
+               if (pud) {
+                       pmd = pmd_offset(pud, addr);
+                       if (pmd)
+                               pte = pte_offset_map(pmd, addr);
+               }
        }
-}
-
-pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
-                             pte_t *ptep)
-{
-       pte_t entry;
-       int i;
-
-       entry = *ptep;
 
-       for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
-               pte_clear(mm, addr, ptep);
-               addr += PAGE_SIZE;
-               ptep++;
-       }
-
-       return entry;
+       return pte;
 }
 
 struct page *follow_huge_addr(struct mm_struct *mm,
index 6f7eb8a3aba53203c57d697c0aaca70185855304..4811d410d1231f47dca866d5c6993ac442951a58 100644 (file)
@@ -30,7 +30,6 @@
 #define HPAGE_SIZE             (1UL << HPAGE_SHIFT)
 #define HPAGE_MASK             (~(HPAGE_SIZE-1))
 #define HUGETLB_PAGE_ORDER     (HPAGE_SHIFT-PAGE_SHIFT)
-#define ARCH_HAS_SETCLEAR_HUGE_PTE
 #endif
 
 #ifdef __KERNEL__