nommu: Provide vmalloc_exec().
[linux-2.6.git] / mm / mempolicy.c
index a37a503..e550bec 100644 (file)
@@ -729,7 +729,11 @@ static long do_get_mempolicy(int *policy, nodemask_t *nmask,
        } else {
                *policy = pol == &default_policy ? MPOL_DEFAULT :
                                                pol->mode;
-               *policy |= pol->flags;
+               /*
+                * Internal mempolicy flags must be masked off before exposing
+                * the policy to userspace.
+                */
+               *policy |= (pol->flags & MPOL_MODE_FLAGS);
        }
 
        if (vma) {
@@ -1477,7 +1481,7 @@ struct zonelist *huge_zonelist(struct vm_area_struct *vma, unsigned long addr,
 
        if (unlikely((*mpol)->mode == MPOL_INTERLEAVE)) {
                zl = node_zonelist(interleave_nid(*mpol, vma, addr,
-                                               HPAGE_SHIFT), gfp_flags);
+                               huge_page_shift(hstate_vma(vma))), gfp_flags);
        } else {
                zl = policy_zonelist(gfp_flags, *mpol);
                if ((*mpol)->mode == MPOL_BIND)
@@ -2216,9 +2220,12 @@ static void check_huge_range(struct vm_area_struct *vma,
 {
        unsigned long addr;
        struct page *page;
+       struct hstate *h = hstate_vma(vma);
+       unsigned long sz = huge_page_size(h);
 
-       for (addr = start; addr < end; addr += HPAGE_SIZE) {
-               pte_t *ptep = huge_pte_offset(vma->vm_mm, addr & HPAGE_MASK);
+       for (addr = start; addr < end; addr += sz) {
+               pte_t *ptep = huge_pte_offset(vma->vm_mm,
+                                               addr & huge_page_mask(h));
                pte_t pte;
 
                if (!ptep)