aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2006-03-25 06:06:46 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-25 11:22:50 -0500
commitcafeb02e098ecd58fb0bd797b2c9fbba3edf54f8 (patch)
treef4d03a748184e24cb0ff4c9a56ba6b0eaefd78d3 /mm
parente00946fe2351307eb3eda7a3343530f6d2d1af2e (diff)
[PATCH] alloc_kmemlist: Some cleanup in preparation for a real memory leak fix
Inspired by Jesper Juhl's patch from today 1. Get rid of err We do not set it to anything else but zero. 2. Drop the CONFIG_NUMA stuff. There are definitions for alloc_alien_cache and free_alien_cache() that do the right thing for the non NUMA case. 3. Better naming of variables. 4. Remove redundant cachep->nodelists[node] expressions. Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/slab.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/mm/slab.c b/mm/slab.c
index 351aa6c587f7..ef9f60fe37d6 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3424,37 +3424,38 @@ static int alloc_kmemlist(struct kmem_cache *cachep)
3424{ 3424{
3425 int node; 3425 int node;
3426 struct kmem_list3 *l3; 3426 struct kmem_list3 *l3;
3427 int err = 0; 3427 struct array_cache *new_shared;
3428 struct array_cache **new_alien;
3428 3429
3429 for_each_online_node(node) { 3430 for_each_online_node(node) {
3430 struct array_cache *nc = NULL, *new; 3431
3431 struct array_cache **new_alien = NULL;
3432#ifdef CONFIG_NUMA
3433 new_alien = alloc_alien_cache(node, cachep->limit); 3432 new_alien = alloc_alien_cache(node, cachep->limit);
3434 if (!new_alien) 3433 if (!new_alien)
3435 goto fail; 3434 goto fail;
3436#endif 3435
3437 new = alloc_arraycache(node, cachep->shared*cachep->batchcount, 3436 new_shared = alloc_arraycache(node, cachep->shared*cachep->batchcount,
3438 0xbaadf00d); 3437 0xbaadf00d);
3439 if (!new) 3438 if (!new_shared)
3440 goto fail; 3439 goto fail;
3440
3441 l3 = cachep->nodelists[node]; 3441 l3 = cachep->nodelists[node];
3442 if (l3) { 3442 if (l3) {
3443 struct array_cache *shared = l3->shared;
3444
3443 spin_lock_irq(&l3->list_lock); 3445 spin_lock_irq(&l3->list_lock);
3444 3446
3445 nc = cachep->nodelists[node]->shared; 3447 if (shared)
3446 if (nc) 3448 free_block(cachep, shared->entry, shared->avail, node);
3447 free_block(cachep, nc->entry, nc->avail, node);
3448 3449
3449 l3->shared = new; 3450 l3->shared = new_shared;
3450 if (!cachep->nodelists[node]->alien) { 3451 if (!l3->alien) {
3451 l3->alien = new_alien; 3452 l3->alien = new_alien;
3452 new_alien = NULL; 3453 new_alien = NULL;
3453 } 3454 }
3454 l3->free_limit = (1 + nr_cpus_node(node)) * 3455 l3->free_limit = (1 + nr_cpus_node(node)) *
3455 cachep->batchcount + cachep->num; 3456 cachep->batchcount + cachep->num;
3456 spin_unlock_irq(&l3->list_lock); 3457 spin_unlock_irq(&l3->list_lock);
3457 kfree(nc); 3458 kfree(shared);
3458 free_alien_cache(new_alien); 3459 free_alien_cache(new_alien);
3459 continue; 3460 continue;
3460 } 3461 }
@@ -3465,16 +3466,15 @@ static int alloc_kmemlist(struct kmem_cache *cachep)
3465 kmem_list3_init(l3); 3466 kmem_list3_init(l3);
3466 l3->next_reap = jiffies + REAPTIMEOUT_LIST3 + 3467 l3->next_reap = jiffies + REAPTIMEOUT_LIST3 +
3467 ((unsigned long)cachep) % REAPTIMEOUT_LIST3; 3468 ((unsigned long)cachep) % REAPTIMEOUT_LIST3;
3468 l3->shared = new; 3469 l3->shared = new_shared;
3469 l3->alien = new_alien; 3470 l3->alien = new_alien;
3470 l3->free_limit = (1 + nr_cpus_node(node)) * 3471 l3->free_limit = (1 + nr_cpus_node(node)) *
3471 cachep->batchcount + cachep->num; 3472 cachep->batchcount + cachep->num;
3472 cachep->nodelists[node] = l3; 3473 cachep->nodelists[node] = l3;
3473 } 3474 }
3474 return err; 3475 return 0;
3475fail: 3476fail:
3476 err = -ENOMEM; 3477 return -ENOMEM;
3477 return err;
3478} 3478}
3479 3479
3480struct ccupdate_struct { 3480struct ccupdate_struct {