diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/slab.c | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -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; |
3475 | fail: | 3476 | fail: |
3476 | err = -ENOMEM; | 3477 | return -ENOMEM; |
3477 | return err; | ||
3478 | } | 3478 | } |
3479 | 3479 | ||
3480 | struct ccupdate_struct { | 3480 | struct ccupdate_struct { |