diff options
author | Yasunori Goto <y-goto@jp.fujitsu.com> | 2007-10-21 19:41:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-22 11:13:17 -0400 |
commit | b9049e234401e1fad8459d69a952b174d76c399d (patch) | |
tree | 619adc6533f33379baf25253ff56603b272453c8 /include/linux | |
parent | 7b78d335ac15b10bbcb0397c635d7f0d569b0270 (diff) |
memory hotplug: make kmem_cache_node for SLUB on memory online avoid panic
Fix a panic due to access NULL pointer of kmem_cache_node at discard_slab()
after memory online.
When memory online is called, kmem_cache_nodes are created for all SLUBs
for new node whose memory are available.
slab_mem_going_online_callback() is called to make kmem_cache_node() in
callback of memory online event. If it (or other callbacks) fails, then
slab_mem_offline_callback() is called for rollback.
In memory offline, slab_mem_going_offline_callback() is called to shrink
all slub cache, then slab_mem_offline_callback() is called later.
[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: locking fix]
[akpm@linux-foundation.org: build fix]
Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/memory.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/memory.h b/include/linux/memory.h index ec376e482abb..33f0ff0cf634 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h | |||
@@ -83,10 +83,14 @@ extern int memory_notify(unsigned long val, void *v); | |||
83 | 83 | ||
84 | #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ | 84 | #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ |
85 | 85 | ||
86 | #ifdef CONFIG_MEMORY_HOTPLUG | ||
86 | #define hotplug_memory_notifier(fn, pri) { \ | 87 | #define hotplug_memory_notifier(fn, pri) { \ |
87 | static struct notifier_block fn##_mem_nb = \ | 88 | static struct notifier_block fn##_mem_nb = \ |
88 | { .notifier_call = fn, .priority = pri }; \ | 89 | { .notifier_call = fn, .priority = pri }; \ |
89 | register_memory_notifier(&fn##_mem_nb); \ | 90 | register_memory_notifier(&fn##_mem_nb); \ |
90 | } | 91 | } |
92 | #else | ||
93 | #define hotplug_memory_notifier(fn, pri) do { } while (0) | ||
94 | #endif | ||
91 | 95 | ||
92 | #endif /* _LINUX_MEMORY_H_ */ | 96 | #endif /* _LINUX_MEMORY_H_ */ |