* [RESEND PATCH] slab: skip kmemleak_object in leaks_show()
@ 2019-05-14 14:47 Qian Cai
2019-05-20 17:18 ` David Rientjes
0 siblings, 1 reply; 2+ messages in thread
From: Qian Cai @ 2019-05-14 14:47 UTC (permalink / raw)
To: akpm
Cc: cl, penberg, rientjes, iamjoonsoo.kim, catalin.marinas, linux-mm,
linux-kernel, Qian Cai
Running tests on a debug kernel will usually generate a large number of
kmemleak objects.
# grep kmemleak /proc/slabinfo
kmemleak_object 2243606 3436210 ...
As the result, reading /proc/slab_allocators could easily loop forever
while processing the kmemleak_object cache and any additional freeing or
allocating objects will trigger a reprocessing. To make a situation
worse, soft-lockups could easily happen in this sitatuion which will
call printk() to allocate more kmemleak objects to guarantee a livelock.
Since kmemleak_object has a single call site (create_object()), there
isn't much new information compared with slabinfo. Just skip it.
Signed-off-by: Qian Cai <cai@lca.pw>
---
mm/slab.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/mm/slab.c b/mm/slab.c
index 20f318f4f56e..85d1d223f879 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -4285,6 +4285,15 @@ static int leaks_show(struct seq_file *m, void *p)
if (!(cachep->flags & SLAB_RED_ZONE))
return 0;
+ /*
+ * /proc/slabinfo has the same information, so skip kmemleak here due to
+ * a high volume and its RCU free could make cachep->store_user_clean
+ * dirty all the time.
+ */
+ if (IS_ENABLED(CONFIG_DEBUG_KMEMLEAK) &&
+ !strcmp("kmemleak_object", cachep->name))
+ return 0;
+
/*
* Set store_user_clean and start to grab stored user information
* for all objects on this cache. If some alloc/free requests comes
--
2.20.1 (Apple Git-117)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RESEND PATCH] slab: skip kmemleak_object in leaks_show()
2019-05-14 14:47 [RESEND PATCH] slab: skip kmemleak_object in leaks_show() Qian Cai
@ 2019-05-20 17:18 ` David Rientjes
0 siblings, 0 replies; 2+ messages in thread
From: David Rientjes @ 2019-05-20 17:18 UTC (permalink / raw)
To: Qian Cai
Cc: akpm, cl, penberg, iamjoonsoo.kim, catalin.marinas, linux-mm,
linux-kernel
On Tue, 14 May 2019, Qian Cai wrote:
> Running tests on a debug kernel will usually generate a large number of
> kmemleak objects.
>
> # grep kmemleak /proc/slabinfo
> kmemleak_object 2243606 3436210 ...
>
> As the result, reading /proc/slab_allocators could easily loop forever
> while processing the kmemleak_object cache and any additional freeing or
> allocating objects will trigger a reprocessing. To make a situation
> worse, soft-lockups could easily happen in this sitatuion which will
> call printk() to allocate more kmemleak objects to guarantee a livelock.
>
> Since kmemleak_object has a single call site (create_object()), there
> isn't much new information compared with slabinfo. Just skip it.
>
> Signed-off-by: Qian Cai <cai@lca.pw>
I assume this is now obsolete since commit 7878c231dae0 ("slab: remove
/proc/slab_allocators").
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-20 17:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-14 14:47 [RESEND PATCH] slab: skip kmemleak_object in leaks_show() Qian Cai
2019-05-20 17:18 ` David Rientjes
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).