BPF List
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Puranjay Mohan <puranjay@kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Josh Triplett <josh@joshtriplett.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	James Clark <james.clark@linaro.org>,
	rcu@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org,
	linux-perf-users@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 2/2] uprobes: Switch uretprobes_srcu to SRCU-fast-updown
Date: Fri, 31 Jul 2026 01:37:20 +0200	[thread overview]
Message-ID: <20260730233720.GC776954@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <CAEf4Bza3LeVB-z3jwMdnBGLdjpPr9tZFhGHt5pUwui64ZX66Lw@mail.gmail.com>

On Thu, Jul 30, 2026 at 03:27:27PM -0700, Andrii Nakryiko wrote:
> On Tue, Jul 21, 2026 at 12:44 PM Kumar Kartikeya Dwivedi
> <memxor@gmail.com> wrote:
> >
> > On Fri Jul 10, 2026 at 11:23 PM CEST, Andrii Nakryiko wrote:
> > > On Mon, Jul 6, 2026 at 10:28 AM Puranjay Mohan <puranjay@kernel.org> wrote:
> > >>
> > >> uretprobes_srcu currently uses normal SRCU, which issues
> > >> two smp_mb() per read lock/unlock pair. This overhead is
> > >> paid on every uretprobe hit.
> > >>
> > >> Switch to SRCU-fast-updown, which eliminates the per-reader
> > >> memory barriers by moving the ordering cost to the
> > >> grace-period side (synchronize_rcu() instead of smp_mb()).
> > >> This is acceptable because grace periods (uprobe
> > >> unregistration) are infrequent compared to reader-side
> > >> uretprobe hits.
> > >>
> > >> The updown flavor is required because the SRCU read lock is
> > >> taken in prepare_uretprobe() when a return instance is
> > >> created and is held until that return instance is finalized.
> > >> The traced thread returns to user space in between, so the
> > >> lock is inherently released in a different context from
> > >> where it was acquired: on the normal return path via
> > >> uprobe_handle_trampoline() -> hprobe_finalize(), or from
> > >> ri_timer() (expiry) or dup_utask() (fork) via
> > >> hprobe_expire(). srcu_down_read_fast() / srcu_up_read_fast()
> > >> are designed for this acquire-here / release-elsewhere
> > >> pattern and, unlike the same-context srcu_read_lock_fast()
> > >> variant, do not carry the lockdep read-side tracking that
> > >> would warn on it.
> > >>
> > >> The short, same-context SRCU sections in ri_timer() and
> > >> dup_utask() (which guard the uprobe against reuse across the
> > >> hprobe_expire() cmpxchg) instead use guard(srcu_fast_updown)
> > >> for proper lockdep coverage.
> > >>
> > >> Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
> > >> ---
> > >>  include/linux/uprobes.h |  5 +++--
> > >>  kernel/events/uprobes.c | 29 +++++++++++++++++------------
> > >>  2 files changed, 20 insertions(+), 14 deletions(-)
> > >>
> > >
> > > Very straightforward replacement and will improve performance, thanks!
> > > LGTM. Peter or Mingo, I assume you guys will want to route this
> > > through your tip tree, right?
> > >
> > > Acked-by: Andrii Nakryiko <andrii@kernel.org>
> > >
> >
> > Hi Peter, Ingo,
> >
> > Gentle ping for this.
> >
> 
> Another ping, please consider applying, thanks!

Got them, thanks!

  reply	other threads:[~2026-07-30 23:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06 17:27 [PATCH bpf-next 0/2] uprobes: Switch uretprobes_srcu to SRCU-fast-updown Puranjay Mohan
2026-07-06 17:27 ` [PATCH bpf-next 1/2] srcu: Add lock guard for srcu_fast_updown flavor Puranjay Mohan
2026-07-06 17:36   ` Paul E. McKenney
2026-07-11 13:02   ` Oleg Nesterov
2026-07-06 17:27 ` [PATCH bpf-next 2/2] uprobes: Switch uretprobes_srcu to SRCU-fast-updown Puranjay Mohan
2026-07-06 17:42   ` sashiko-bot
2026-07-10 21:23   ` Andrii Nakryiko
2026-07-21 19:44     ` Kumar Kartikeya Dwivedi
2026-07-30 22:27       ` Andrii Nakryiko
2026-07-30 23:37         ` Peter Zijlstra [this message]
2026-07-11 13:01   ` Oleg Nesterov

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=20260730233720.GC776954@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jiangshanlai@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=memxor@gmail.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=oleg@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=puranjay@kernel.org \
    --cc=rcu@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /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