fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / powerpc / mm / hugetlbpage.c
index 5615acc..1bb20d8 100644 (file)
@@ -146,6 +146,11 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
        return hugepte_offset(hpdp, addr);
 }
 
+int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
+{
+       return 0;
+}
+
 static void free_hugepte_range(struct mmu_gather *tlb, hugepd_t *hpdp)
 {
        pte_t *hugepte = hugepd_page(*hpdp);
@@ -480,9 +485,6 @@ static int open_high_hpage_areas(struct mm_struct *mm, u16 newareas)
 
        mm->context.high_htlb_areas |= newareas;
 
-       /* update the paca copy of the context struct */
-       get_paca()->context = mm->context;
-
        /* the context change must make it to memory before the flush,
         * so that further SLB misses do the right thing. */
        mb();
@@ -494,11 +496,15 @@ static int open_high_hpage_areas(struct mm_struct *mm, u16 newareas)
        return 0;
 }
 
-int prepare_hugepage_range(unsigned long addr, unsigned long len)
+int prepare_hugepage_range(unsigned long addr, unsigned long len, pgoff_t pgoff)
 {
        int err = 0;
 
-       if ( (addr+len) < addr )
+       if (pgoff & (~HPAGE_MASK >> PAGE_SHIFT))
+               return -EINVAL;
+       if (len & ~HPAGE_MASK)
+               return -EINVAL;
+       if (addr & ~HPAGE_MASK)
                return -EINVAL;
 
        if (addr < 0x100000000UL)
@@ -738,7 +744,8 @@ static int htlb_check_hinted_area(unsigned long addr, unsigned long len)
        struct vm_area_struct *vma;
 
        vma = find_vma(current->mm, addr);
-       if (!vma || ((addr + len) <= vma->vm_start))
+       if (TASK_SIZE - len >= addr &&
+           (!vma || ((addr + len) <= vma->vm_start)))
                return 0;
 
        return -ENOMEM;
@@ -809,6 +816,8 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
                return -EINVAL;
        if (len & ~HPAGE_MASK)
                return -EINVAL;
+       if (len > TASK_SIZE)
+               return -ENOMEM;
 
        if (!cpu_has_feature(CPU_FTR_16M_PAGE))
                return -EINVAL;
@@ -817,9 +826,6 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
        BUG_ON((addr + len)  < addr);
 
        if (test_thread_flag(TIF_32BIT)) {
-               /* Paranoia, caller should have dealt with this */
-               BUG_ON((addr + len) > 0x100000000UL);
-
                curareas = current->mm->context.low_htlb_areas;
 
                /* First see if we can use the hint address */
@@ -1041,7 +1047,7 @@ repeat:
        return err;
 }
 
-static void zero_ctor(void *addr, kmem_cache_t *cache, unsigned long flags)
+static void zero_ctor(void *addr, struct kmem_cache *cache, unsigned long flags)
 {
        memset(addr, 0, kmem_cache_size(cache));
 }