All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qian Cai <cai@lca.pw>
To: 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 22:29:57 -0400	[thread overview]
Message-ID: <20200821022955.GD4622@lca.pw> (raw)
In-Reply-To: <20200821012750.qxiklfhuaryajvhn@linux-p48b>

On Thu, Aug 20, 2020 at 06:27:50PM -0700, Davidlohr Bueso wrote:
> 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.

This makes thing clearer.

Reviewed-by: Qian Cai <cai@lca.pw>

  reply	other threads:[~2020-08-21  2:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-20 20:39 [PATCH] mm/kmemleak: rely on rcu for task stack scanning Davidlohr Bueso
2020-08-21  0:25 ` Qian Cai
2020-08-21  1:27   ` Davidlohr Bueso
2020-08-21  2:29     ` Qian Cai [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=20200821022955.GD4622@lca.pw \
    --to=cai@lca.pw \
    --cc=akpm@linux-foundation.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.