diff options
-rw-r--r-- | MAINTAINERS | 4 | ||||
-rw-r--r-- | include/linux/memory_hotplug.h | 6 | ||||
-rw-r--r-- | mm/memory_hotplug.c | 4 | ||||
-rw-r--r-- | mm/slab.c | 6 | ||||
-rw-r--r-- | mm/slub.c | 4 |
5 files changed, 17 insertions, 7 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 89e4d4b145bb..1af022e63668 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -3684,7 +3684,7 @@ F: kernel/debug/ | |||
3684 | 3684 | ||
3685 | KMEMCHECK | 3685 | KMEMCHECK |
3686 | M: Vegard Nossum <vegardno@ifi.uio.no> | 3686 | M: Vegard Nossum <vegardno@ifi.uio.no> |
3687 | M: Pekka Enberg <penberg@cs.helsinki.fi> | 3687 | M: Pekka Enberg <penberg@kernel.org> |
3688 | S: Maintained | 3688 | S: Maintained |
3689 | F: Documentation/kmemcheck.txt | 3689 | F: Documentation/kmemcheck.txt |
3690 | F: arch/x86/include/asm/kmemcheck.h | 3690 | F: arch/x86/include/asm/kmemcheck.h |
@@ -5646,7 +5646,7 @@ F: drivers/net/sky2.* | |||
5646 | 5646 | ||
5647 | SLAB ALLOCATOR | 5647 | SLAB ALLOCATOR |
5648 | M: Christoph Lameter <cl@linux-foundation.org> | 5648 | M: Christoph Lameter <cl@linux-foundation.org> |
5649 | M: Pekka Enberg <penberg@cs.helsinki.fi> | 5649 | M: Pekka Enberg <penberg@kernel.org> |
5650 | M: Matt Mackall <mpm@selenic.com> | 5650 | M: Matt Mackall <mpm@selenic.com> |
5651 | L: linux-mm@kvack.org | 5651 | L: linux-mm@kvack.org |
5652 | S: Maintained | 5652 | S: Maintained |
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 24376fe7ee68..8122018d3000 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h | |||
@@ -165,6 +165,12 @@ extern void register_page_bootmem_info_node(struct pglist_data *pgdat); | |||
165 | extern void put_page_bootmem(struct page *page); | 165 | extern void put_page_bootmem(struct page *page); |
166 | #endif | 166 | #endif |
167 | 167 | ||
168 | /* | ||
169 | * Lock for memory hotplug guarantees 1) all callbacks for memory hotplug | ||
170 | * notifier will be called under this. 2) offline/online/add/remove memory | ||
171 | * will not run simultaneously. | ||
172 | */ | ||
173 | |||
168 | void lock_memory_hotplug(void); | 174 | void lock_memory_hotplug(void); |
169 | void unlock_memory_hotplug(void); | 175 | void unlock_memory_hotplug(void); |
170 | 176 | ||
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index e92f04749fcb..321fc7455df7 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -409,6 +409,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages) | |||
409 | int ret; | 409 | int ret; |
410 | struct memory_notify arg; | 410 | struct memory_notify arg; |
411 | 411 | ||
412 | lock_memory_hotplug(); | ||
412 | arg.start_pfn = pfn; | 413 | arg.start_pfn = pfn; |
413 | arg.nr_pages = nr_pages; | 414 | arg.nr_pages = nr_pages; |
414 | arg.status_change_nid = -1; | 415 | arg.status_change_nid = -1; |
@@ -421,6 +422,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages) | |||
421 | ret = notifier_to_errno(ret); | 422 | ret = notifier_to_errno(ret); |
422 | if (ret) { | 423 | if (ret) { |
423 | memory_notify(MEM_CANCEL_ONLINE, &arg); | 424 | memory_notify(MEM_CANCEL_ONLINE, &arg); |
425 | unlock_memory_hotplug(); | ||
424 | return ret; | 426 | return ret; |
425 | } | 427 | } |
426 | /* | 428 | /* |
@@ -445,6 +447,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages) | |||
445 | printk(KERN_DEBUG "online_pages %lx at %lx failed\n", | 447 | printk(KERN_DEBUG "online_pages %lx at %lx failed\n", |
446 | nr_pages, pfn); | 448 | nr_pages, pfn); |
447 | memory_notify(MEM_CANCEL_ONLINE, &arg); | 449 | memory_notify(MEM_CANCEL_ONLINE, &arg); |
450 | unlock_memory_hotplug(); | ||
448 | return ret; | 451 | return ret; |
449 | } | 452 | } |
450 | 453 | ||
@@ -469,6 +472,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages) | |||
469 | 472 | ||
470 | if (onlined_pages) | 473 | if (onlined_pages) |
471 | memory_notify(MEM_ONLINE, &arg); | 474 | memory_notify(MEM_ONLINE, &arg); |
475 | unlock_memory_hotplug(); | ||
472 | 476 | ||
473 | return 0; | 477 | return 0; |
474 | } | 478 | } |
@@ -284,7 +284,7 @@ struct kmem_list3 { | |||
284 | * Need this for bootstrapping a per node allocator. | 284 | * Need this for bootstrapping a per node allocator. |
285 | */ | 285 | */ |
286 | #define NUM_INIT_LISTS (3 * MAX_NUMNODES) | 286 | #define NUM_INIT_LISTS (3 * MAX_NUMNODES) |
287 | struct kmem_list3 __initdata initkmem_list3[NUM_INIT_LISTS]; | 287 | static struct kmem_list3 __initdata initkmem_list3[NUM_INIT_LISTS]; |
288 | #define CACHE_CACHE 0 | 288 | #define CACHE_CACHE 0 |
289 | #define SIZE_AC MAX_NUMNODES | 289 | #define SIZE_AC MAX_NUMNODES |
290 | #define SIZE_L3 (2 * MAX_NUMNODES) | 290 | #define SIZE_L3 (2 * MAX_NUMNODES) |
@@ -4053,7 +4053,7 @@ static int enable_cpucache(struct kmem_cache *cachep, gfp_t gfp) | |||
4053 | * necessary. Note that the l3 listlock also protects the array_cache | 4053 | * necessary. Note that the l3 listlock also protects the array_cache |
4054 | * if drain_array() is used on the shared array. | 4054 | * if drain_array() is used on the shared array. |
4055 | */ | 4055 | */ |
4056 | void drain_array(struct kmem_cache *cachep, struct kmem_list3 *l3, | 4056 | static void drain_array(struct kmem_cache *cachep, struct kmem_list3 *l3, |
4057 | struct array_cache *ac, int force, int node) | 4057 | struct array_cache *ac, int force, int node) |
4058 | { | 4058 | { |
4059 | int tofree; | 4059 | int tofree; |
@@ -4317,7 +4317,7 @@ static const struct seq_operations slabinfo_op = { | |||
4317 | * @count: data length | 4317 | * @count: data length |
4318 | * @ppos: unused | 4318 | * @ppos: unused |
4319 | */ | 4319 | */ |
4320 | ssize_t slabinfo_write(struct file *file, const char __user * buffer, | 4320 | static ssize_t slabinfo_write(struct file *file, const char __user *buffer, |
4321 | size_t count, loff_t *ppos) | 4321 | size_t count, loff_t *ppos) |
4322 | { | 4322 | { |
4323 | char kbuf[MAX_SLABINFO_WRITE + 1], *tmp; | 4323 | char kbuf[MAX_SLABINFO_WRITE + 1], *tmp; |
@@ -3797,7 +3797,7 @@ static ssize_t show_slab_objects(struct kmem_cache *s, | |||
3797 | } | 3797 | } |
3798 | } | 3798 | } |
3799 | 3799 | ||
3800 | down_read(&slub_lock); | 3800 | lock_memory_hotplug(); |
3801 | #ifdef CONFIG_SLUB_DEBUG | 3801 | #ifdef CONFIG_SLUB_DEBUG |
3802 | if (flags & SO_ALL) { | 3802 | if (flags & SO_ALL) { |
3803 | for_each_node_state(node, N_NORMAL_MEMORY) { | 3803 | for_each_node_state(node, N_NORMAL_MEMORY) { |
@@ -3838,7 +3838,7 @@ static ssize_t show_slab_objects(struct kmem_cache *s, | |||
3838 | x += sprintf(buf + x, " N%d=%lu", | 3838 | x += sprintf(buf + x, " N%d=%lu", |
3839 | node, nodes[node]); | 3839 | node, nodes[node]); |
3840 | #endif | 3840 | #endif |
3841 | up_read(&slub_lock); | 3841 | unlock_memory_hotplug(); |
3842 | kfree(nodes); | 3842 | kfree(nodes); |
3843 | return x + sprintf(buf + x, "\n"); | 3843 | return x + sprintf(buf + x, "\n"); |
3844 | } | 3844 | } |