aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPekka Enberg <penberg@kernel.org>2011-01-15 06:28:17 -0500
committerPekka Enberg <penberg@kernel.org>2011-01-15 06:28:17 -0500
commit597fb188cbee2d371246e1669bbc6051bb666aa9 (patch)
treefd9cb605050ca15274cf391dc6bd4073d04808df
parent38567333a6dabd0f2b4150e9fb6dd8e3ba2985e5 (diff)
parent04d94879c8a4973b5499dc26b9d38acee8928791 (diff)
Merge branch 'slub/hotplug' into slab/urgent
-rw-r--r--include/linux/memory_hotplug.h6
-rw-r--r--mm/memory_hotplug.c4
-rw-r--r--mm/slub.c4
3 files changed, 12 insertions, 2 deletions
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);
165extern void put_page_bootmem(struct page *page); 165extern 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
168void lock_memory_hotplug(void); 174void lock_memory_hotplug(void);
169void unlock_memory_hotplug(void); 175void 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}
diff --git a/mm/slub.c b/mm/slub.c
index c7ef0070dd86..e15aa7f193c9 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -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}