From: Davidlohr Bueso <dave@stgolabs.net>
To: Qian Cai <cai@lca.pw>
Cc: akpm@linux-foundation.org, catalin.marinas@arm.com,
oleg@redhat.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Davidlohr Bueso <dbueso@suse.de>
Subject: Re: [PATCH] mm/kmemleak: rely on rcu for task stack scanning
Date: Thu, 20 Aug 2020 18:27:50 -0700 [thread overview]
Message-ID: <20200821012750.qxiklfhuaryajvhn@linux-p48b> (raw)
In-Reply-To: <20200821002554.GB4622@lca.pw>
On Thu, 20 Aug 2020, Qian Cai wrote:
>On Thu, Aug 20, 2020 at 01:39:02PM -0700, Davidlohr Bueso wrote:
>> kmemleak_scan() currently relies on the big tasklist_lock
>> hammer to stabilize iterating through the tasklist. Instead,
>> this patch proposes simply using rcu along with the rcu-safe
>> for_each_process_thread flavor (without changing scan semantics),
>> which doesn't make use of next_thread/p->thread_group and thus
>> cannot race with exit. Furthermore, any races with fork()
>> and not seeing the new child should be benign as it's not
>> running yet and can also be detected by the next scan.
>
>It is not entirely clear to me what problem the patch is trying to solve. If
>this is about performance, we will probably need some number.
So in this case avoiding the tasklist_lock could prove beneficial for performance
considering the scan operation is done periodically. I have seen improvements
of 30%-ish when doing similar replacements on very pathological microbenchmarks
(ie stressing get/setpriority(2)).
However my main motivation is that it's one less user of the global lock,
something that Linus has long time wanted to see gone eventually (if ever)
even if the traditional fairness issues has been dealt with now with qrwlocks.
Of course this is a very long ways ahead. This patch also kills another user
of the deprecated tsk->thread_group.
Thanks,
Davidlohr
next prev parent reply other threads:[~2020-08-21 1:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-20 20:39 Davidlohr Bueso
[not found] ` <20200821002554.GB4622@lca.pw>
2020-08-21 1:27 ` Davidlohr Bueso [this message]
2020-08-21 11:20 ` Oleg Nesterov
2020-08-21 18:09 ` Catalin Marinas
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=20200821012750.qxiklfhuaryajvhn@linux-p48b \
--to=dave@stgolabs.net \
--cc=akpm@linux-foundation.org \
--cc=cai@lca.pw \
--cc=catalin.marinas@arm.com \
--cc=dbueso@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=oleg@redhat.com \
/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