diff options
Diffstat (limited to 'mm/slub.c')
-rw-r--r-- | mm/slub.c | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -2435,6 +2435,7 @@ void __init kmem_cache_init(void) | |||
2435 | */ | 2435 | */ |
2436 | create_kmalloc_cache(&kmalloc_caches[0], "kmem_cache_node", | 2436 | create_kmalloc_cache(&kmalloc_caches[0], "kmem_cache_node", |
2437 | sizeof(struct kmem_cache_node), GFP_KERNEL); | 2437 | sizeof(struct kmem_cache_node), GFP_KERNEL); |
2438 | kmalloc_caches[0].refcount = -1; | ||
2438 | #endif | 2439 | #endif |
2439 | 2440 | ||
2440 | /* Able to allocate the per node structures */ | 2441 | /* Able to allocate the per node structures */ |
@@ -2482,6 +2483,12 @@ static int slab_unmergeable(struct kmem_cache *s) | |||
2482 | if (s->ctor) | 2483 | if (s->ctor) |
2483 | return 1; | 2484 | return 1; |
2484 | 2485 | ||
2486 | /* | ||
2487 | * We may have set a slab to be unmergeable during bootstrap. | ||
2488 | */ | ||
2489 | if (s->refcount < 0) | ||
2490 | return 1; | ||
2491 | |||
2485 | return 0; | 2492 | return 0; |
2486 | } | 2493 | } |
2487 | 2494 | ||
@@ -2601,6 +2608,19 @@ static void for_all_slabs(void (*func)(struct kmem_cache *, int), int cpu) | |||
2601 | } | 2608 | } |
2602 | 2609 | ||
2603 | /* | 2610 | /* |
2611 | * Version of __flush_cpu_slab for the case that interrupts | ||
2612 | * are enabled. | ||
2613 | */ | ||
2614 | static void cpu_slab_flush(struct kmem_cache *s, int cpu) | ||
2615 | { | ||
2616 | unsigned long flags; | ||
2617 | |||
2618 | local_irq_save(flags); | ||
2619 | __flush_cpu_slab(s, cpu); | ||
2620 | local_irq_restore(flags); | ||
2621 | } | ||
2622 | |||
2623 | /* | ||
2604 | * Use the cpu notifier to insure that the cpu slabs are flushed when | 2624 | * Use the cpu notifier to insure that the cpu slabs are flushed when |
2605 | * necessary. | 2625 | * necessary. |
2606 | */ | 2626 | */ |
@@ -2614,7 +2634,7 @@ static int __cpuinit slab_cpuup_callback(struct notifier_block *nfb, | |||
2614 | case CPU_UP_CANCELED_FROZEN: | 2634 | case CPU_UP_CANCELED_FROZEN: |
2615 | case CPU_DEAD: | 2635 | case CPU_DEAD: |
2616 | case CPU_DEAD_FROZEN: | 2636 | case CPU_DEAD_FROZEN: |
2617 | for_all_slabs(__flush_cpu_slab, cpu); | 2637 | for_all_slabs(cpu_slab_flush, cpu); |
2618 | break; | 2638 | break; |
2619 | default: | 2639 | default: |
2620 | break; | 2640 | break; |