diff options
author | Christoph Lameter <clameter@engr.sgi.com> | 2006-02-01 06:05:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-01 11:53:17 -0500 |
commit | 18f820f655ce93b1e4d9b48fc6fcafc64157c6bc (patch) | |
tree | 62c759bb1d7d3675a3dee5dbb345cb63dfa7522b /mm/slab.c | |
parent | 3dafccf22751429e69b6266636cf3acf45b48075 (diff) |
[PATCH] slab: minor cleanup to kmem_cache_alloc_node
Clean up kmem_cache_alloc_node a bit.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Acked-by: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/slab.c')
-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 | } |