VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / arch / i386 / mm / hugetlbpage.c
index a8dbbc5..a0eab67 100644 (file)
@@ -15,7 +15,6 @@
 #include <linux/err.h>
 #include <linux/sysctl.h>
 #include <asm/mman.h>
-#include <asm/pgalloc.h>
 #include <asm/tlb.h>
 #include <asm/tlbflush.h>
 
@@ -149,9 +148,6 @@ follow_huge_addr(struct mm_struct *mm, unsigned long address, int write)
        struct page *page;
        struct vm_area_struct *vma;
 
-       if (! mm->used_hugetlb)
-               return ERR_PTR(-EINVAL);
-
        vma = find_vma(mm, addr);
        if (!vma || !is_vm_hugetlb_page(vma))
                return ERR_PTR(-EINVAL);
@@ -248,8 +244,15 @@ int hugetlb_prefault(struct address_space *mapping, struct vm_area_struct *vma)
                        ret = -ENOMEM;
                        goto out;
                }
-               if (!pte_none(*pte))
-                       continue;
+
+               if (!pte_none(*pte)) {
+                       pmd_t *pmd = (pmd_t *) pte;
+
+                       page = pmd_page(*pmd);
+                       pmd_clear(pmd);
+                       dec_page_state(nr_page_table_pages);
+                       page_cache_release(page);
+               }
 
                idx = ((addr - vma->vm_start) >> HPAGE_SHIFT)
                        + (vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT));