aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slub.c
diff options
context:
space:
mode:
authorPekka Enberg <penberg@cs.helsinki.fi>2009-06-17 01:30:54 -0400
committerPekka Enberg <penberg@cs.helsinki.fi>2009-06-17 01:30:54 -0400
commit5caf5c7dc2d303b770e426f7e2238df882f1773b (patch)
tree1dddb1941da34326e8e8becef10761d2d5d7fcc9 /mm/slub.c
parente03ab9d415c47e1ff485b646f95604d3e3a91708 (diff)
parent964cf35c88f93b4927dbc4e950dfa4d880c7f9d1 (diff)
Merge branch 'slub/earlyboot' into for-linus
Conflicts: mm/slub.c
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/mm/slub.c b/mm/slub.c
index b2b0c78ae35..4c6449310a0 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2704,6 +2704,7 @@ static noinline struct kmem_cache *dma_kmalloc_cache(int index, gfp_t flags)
2704 struct kmem_cache *s; 2704 struct kmem_cache *s;
2705 char *text; 2705 char *text;
2706 size_t realsize; 2706 size_t realsize;
2707 unsigned long slabflags;
2707 2708
2708 s = kmalloc_caches_dma[index]; 2709 s = kmalloc_caches_dma[index];
2709 if (s) 2710 if (s)
@@ -2725,10 +2726,18 @@ static noinline struct kmem_cache *dma_kmalloc_cache(int index, gfp_t flags)
2725 (unsigned int)realsize); 2726 (unsigned int)realsize);
2726 s = kmalloc(kmem_size, flags & ~SLUB_DMA); 2727 s = kmalloc(kmem_size, flags & ~SLUB_DMA);
2727 2728
2729 /*
2730 * Must defer sysfs creation to a workqueue because we don't know
2731 * what context we are called from. Before sysfs comes up, we don't
2732 * need to do anything because our sysfs initcall will start by
2733 * adding all existing slabs to sysfs.
2734 */
2735 slabflags = SLAB_CACHE_DMA|SLAB_NOTRACK;
2736 if (slab_state >= SYSFS)
2737 slabflags |= __SYSFS_ADD_DEFERRED;
2738
2728 if (!s || !text || !kmem_cache_open(s, flags, text, 2739 if (!s || !text || !kmem_cache_open(s, flags, text,
2729 realsize, ARCH_KMALLOC_MINALIGN, 2740 realsize, ARCH_KMALLOC_MINALIGN, slabflags, NULL)) {
2730 SLAB_CACHE_DMA|SLAB_NOTRACK|__SYSFS_ADD_DEFERRED,
2731 NULL)) {
2732 kfree(s); 2741 kfree(s);
2733 kfree(text); 2742 kfree(text);
2734 goto unlock_out; 2743 goto unlock_out;
@@ -2737,7 +2746,8 @@ static noinline struct kmem_cache *dma_kmalloc_cache(int index, gfp_t flags)
2737 list_add(&s->list, &slab_caches); 2746 list_add(&s->list, &slab_caches);
2738 kmalloc_caches_dma[index] = s; 2747 kmalloc_caches_dma[index] = s;
2739 2748
2740 schedule_work(&sysfs_add_work); 2749 if (slab_state >= SYSFS)
2750 schedule_work(&sysfs_add_work);
2741 2751
2742unlock_out: 2752unlock_out:
2743 up_write(&slub_lock); 2753 up_write(&slub_lock);