mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-30 11:04:25 +00:00
[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>
This commit is contained in:
parent
3dafccf227
commit
18f820f655
1 changed files with 6 additions and 15 deletions
21
mm/slab.c
21
mm/slab.c
|
@ -2928,27 +2928,18 @@ void *kmem_cache_alloc_node(kmem_cache_t *cachep, gfp_t flags, int nodeid)
|
||||||
unsigned long save_flags;
|
unsigned long save_flags;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
if (nodeid == -1)
|
|
||||||
return __cache_alloc(cachep, flags);
|
|
||||||
|
|
||||||
if (unlikely(!cachep->nodelists[nodeid])) {
|
|
||||||
/* Fall back to __cache_alloc if we run into trouble */
|
|
||||||
printk(KERN_WARNING
|
|
||||||
"slab: not allocating in inactive node %d for cache %s\n",
|
|
||||||
nodeid, cachep->name);
|
|
||||||
return __cache_alloc(cachep, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
cache_alloc_debugcheck_before(cachep, flags);
|
cache_alloc_debugcheck_before(cachep, flags);
|
||||||
local_irq_save(save_flags);
|
local_irq_save(save_flags);
|
||||||
if (nodeid == numa_node_id())
|
|
||||||
|
if (nodeid == -1 || nodeid == numa_node_id() ||
|
||||||
|
!cachep->nodelists[nodeid])
|
||||||
ptr = ____cache_alloc(cachep, flags);
|
ptr = ____cache_alloc(cachep, flags);
|
||||||
else
|
else
|
||||||
ptr = __cache_alloc_node(cachep, flags, nodeid);
|
ptr = __cache_alloc_node(cachep, flags, nodeid);
|
||||||
local_irq_restore(save_flags);
|
local_irq_restore(save_flags);
|
||||||
ptr =
|
|
||||||
cache_alloc_debugcheck_after(cachep, flags, ptr,
|
ptr = cache_alloc_debugcheck_after(cachep, flags, ptr,
|
||||||
__builtin_return_address(0));
|
__builtin_return_address(0));
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue