diff options
-rw-r--r-- | mm/slab.c | 21 |
1 files changed, 6 insertions, 15 deletions
@@ -2928,27 +2928,18 @@ void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int nodeid) | |||
2928 | unsigned long save_flags; | 2928 | unsigned long save_flags; |
2929 | void *ptr; | 2929 | void *ptr; |
2930 | 2930 | ||
2931 | if (nodeid == -1) | ||
2932 | return __cache_alloc(cachep, flags); | ||
2933 | |||
2934 | if (unlikely(!cachep->nodelists[nodeid])) { | ||
2935 | /* Fall back to __cache_alloc if we run into trouble */ | ||
2936 | printk(KERN_WARNING | ||
2937 | "slab: not allocating in inactive node %d for cache %s\n", | ||
2938 | nodeid, cachep->name); | ||
2939 | return __cache_alloc(cachep, flags); | ||
2940 | } | ||
2941 | |||
2942 | cache_alloc_debugcheck_before(cachep, flags); | 2931 | cache_alloc_debugcheck_before(cachep, flags); |
2943 | local_irq_save(save_flags); | 2932 | local_irq_save(save_flags); |
2944 | if (nodeid == numa_node_id()) | 2933 | |
2934 | if (nodeid == -1 || nodeid == numa_node_id() || | ||
2935 | !cachep->nodelists[nodeid]) | ||
2945 | ptr = ____cache_alloc(cachep, flags); | 2936 | ptr = ____cache_alloc(cachep, flags); |
2946 | else | 2937 | else |
2947 | ptr = __cache_alloc_node(cachep, flags, nodeid); | 2938 | ptr = __cache_alloc_node(cachep, flags, nodeid); |
2948 | local_irq_restore(save_flags); | 2939 | local_irq_restore(save_flags); |
2949 | ptr = | 2940 | |
2950 | cache_alloc_debugcheck_after(cachep, flags, ptr, | 2941 | ptr = cache_alloc_debugcheck_after(cachep, flags, ptr, |
2951 | __builtin_return_address(0)); | 2942 | __builtin_return_address(0)); |
2952 | 2943 | ||
2953 | return ptr; | 2944 | return ptr; |
2954 | } | 2945 | } |