From: qiang.zhang@windriver.com
To: vbabka@suse.cz, akpm@linux-foundation.org, sfr@canb.auug.org.au
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH] mm, slub: add cpus_read_lock/unlock() for slab_mem_going_offline_callback()
Date: Mon, 16 Aug 2021 15:46:05 +0800 [thread overview]
Message-ID: <20210816074605.30336-1-qiang.zhang@windriver.com> (raw)
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
next reply other threads:[~2021-08-16 7:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-16 7:46 qiang.zhang [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210816074605.30336-1-qiang.zhang@windriver.com \
--to=qiang.zhang@windriver.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sfr@canb.auug.org.au \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox