[PATCH] mm, slub: add cpus_read_lock/unlock() for slab_mem_going_offline_callback()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Qiang.Zhang" <qiang.zhang@xxxxxxxxxxxxx>

The flush_all_cpus_locked() should be called with cpus_read_lock/unlock(),
ensure flush_cpu_slab() can be executed on schedule_on CPU.

Fixes: 1c84f3c91640 ("mm, slub: fix memory and cpu hotplug related lock ordering issues")
Signed-off-by: Qiang.Zhang <qiang.zhang@xxxxxxxxxxxxx>
---
 mm/slub.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/slub.c b/mm/slub.c
index 5543d57cb128..cf3f93abbd3e 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4593,12 +4593,14 @@ static int slab_mem_going_offline_callback(void *arg)
 {
 	struct kmem_cache *s;
 
+	cpus_read_lock();
 	mutex_lock(&slab_mutex);
 	list_for_each_entry(s, &slab_caches, list) {
 		flush_all_cpus_locked(s);
 		__kmem_cache_do_shrink(s);
 	}
 	mutex_unlock(&slab_mutex);
+	cpus_read_unlock();
 
 	return 0;
 }
-- 
2.17.1





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux