aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorMike Kravetz <kravetz@us.ibm.com>2006-05-15 12:44:13 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-05-15 14:20:56 -0400
commit39d24e64263cd3211705d3b61ea4171c65030921 (patch)
treeb527b1395b070180b7f930c0a89530f11bce7b3c /mm
parent48564e628bd7662d7a0b3ac81c41cd0e4cc36dae (diff)
[PATCH] add slab_is_available() routine for boot code
slab_is_available() indicates slab based allocators are available for use. SPARSEMEM code needs to know this as it can be called at various times during the boot process. Signed-off-by: Mike Kravetz <kravetz@us.ibm.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.c8
-rw-r--r--mm/sparse.c2
2 files changed, 9 insertions, 1 deletions
diff --git a/mm/slab.c b/mm/slab.c
index c32af7e7581e..b1d643b5238d 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -700,6 +700,14 @@ static enum {
700 FULL 700 FULL
701} g_cpucache_up; 701} g_cpucache_up;
702 702
703/*
704 * used by boot code to determine if it can use slab based allocator
705 */
706int slab_is_available(void)
707{
708 return g_cpucache_up == FULL;
709}
710
703static DEFINE_PER_CPU(struct work_struct, reap_work); 711static DEFINE_PER_CPU(struct work_struct, reap_work);
704 712
705static void free_block(struct kmem_cache *cachep, void **objpp, int len, 713static void free_block(struct kmem_cache *cachep, void **objpp, int len,
diff --git a/mm/sparse.c b/mm/sparse.c
index d7c32de99ee8..c5e89eb9ac8f 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -32,7 +32,7 @@ static struct mem_section *sparse_index_alloc(int nid)
32 unsigned long array_size = SECTIONS_PER_ROOT * 32 unsigned long array_size = SECTIONS_PER_ROOT *
33 sizeof(struct mem_section); 33 sizeof(struct mem_section);
34 34
35 if (system_state == SYSTEM_RUNNING) 35 if (slab_is_available())
36 section = kmalloc_node(array_size, GFP_KERNEL, nid); 36 section = kmalloc_node(array_size, GFP_KERNEL, nid);
37 else 37 else
38 section = alloc_bootmem_node(NODE_DATA(nid), array_size); 38 section = alloc_bootmem_node(NODE_DATA(nid), array_size);