On Fri Jul 10, 2026 at 11:23 PM CEST, Andrii Nakryiko wrote: > On Mon, Jul 6, 2026 at 10:28 AM Puranjay Mohan <[email protected]> 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 <[email protected]> >> --- >> 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 <[email protected]> >
Hi Peter, Ingo, Gentle ping for this. > [...]
