linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm, slub: add cpus_read_lock/unlock() for slab_mem_going_offline_callback()
@ 2021-08-16  7:46 qiang.zhang
  2021-08-16  8:04 ` David Hildenbrand
  0 siblings, 1 reply; 6+ messages in thread
From: qiang.zhang @ 2021-08-16  7:46 UTC (permalink / raw)
  To: vbabka, akpm, sfr; +Cc: linux-mm, linux-kernel

From: "Qiang.Zhang" <qiang.zhang@windriver.com>

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@windriver.com>
---
 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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-08-17  7:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-16  7:46 [PATCH] mm, slub: add cpus_read_lock/unlock() for slab_mem_going_offline_callback() qiang.zhang
2021-08-16  8:04 ` David Hildenbrand
2021-08-16  8:10   ` Zhang, Qiang
2021-08-16  8:17   ` Stephen Rothwell
2021-08-16  8:23     ` David Hildenbrand
2021-08-17  7:57   ` Vlastimil Babka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).