Merge branch 'slab/next' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg...
[linux.git] / mm / slab.c
index f6718197cdd0177c766481b33e0aac0844a7a52f..388cb1ae6fbc4907e6f0c6776b652adb5d055fe7 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3063,7 +3063,7 @@ out:
 
 #ifdef CONFIG_NUMA
 /*
- * Try allocating on another node if PF_SPREAD_SLAB|PF_MEMPOLICY.
+ * Try allocating on another node if PF_SPREAD_SLAB is a mempolicy is set.
  *
  * If we are in_interrupt, then process context, including cpusets and
  * mempolicy, may not apply and should not be used for allocation policy.
@@ -3078,7 +3078,7 @@ static void *alternate_node_alloc(struct kmem_cache *cachep, gfp_t flags)
        if (cpuset_do_slab_mem_spread() && (cachep->flags & SLAB_MEM_SPREAD))
                nid_alloc = cpuset_slab_spread_node();
        else if (current->mempolicy)
-               nid_alloc = slab_node();
+               nid_alloc = mempolicy_slab_node();
        if (nid_alloc != nid_here)
                return ____cache_alloc_node(cachep, flags, nid_alloc);
        return NULL;
@@ -3109,8 +3109,8 @@ static void *fallback_alloc(struct kmem_cache *cache, gfp_t flags)
        local_flags = flags & (GFP_CONSTRAINT_MASK|GFP_RECLAIM_MASK);
 
 retry_cpuset:
-       cpuset_mems_cookie = get_mems_allowed();
-       zonelist = node_zonelist(slab_node(), flags);
+       cpuset_mems_cookie = read_mems_allowed_begin();
+       zonelist = node_zonelist(mempolicy_slab_node(), flags);
 
 retry:
        /*
@@ -3167,7 +3167,7 @@ retry:
                }
        }
 
-       if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !obj))
+       if (unlikely(!obj && read_mems_allowed_retry(cpuset_mems_cookie)))
                goto retry_cpuset;
        return obj;
 }
@@ -3295,7 +3295,7 @@ __do_cache_alloc(struct kmem_cache *cache, gfp_t flags)
 {
        void *objp;
 
-       if (unlikely(current->flags & (PF_SPREAD_SLAB | PF_MEMPOLICY))) {
+       if (current->mempolicy || unlikely(current->flags & PF_SPREAD_SLAB)) {
                objp = alternate_node_alloc(cache, flags);
                if (objp)
                        goto out;