From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D8A83B8111 for ; Fri, 10 Jul 2026 21:23:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.216.42 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783718634; cv=pass; b=Nbql0cndRzhpqNyc8Rtps52ZIaTEJ2sHOTzxy3Q71ax+B9DDtK0SvT5+mKNl+6e3zh6KRANQQ0Gt/o5aqOMxcaPzEI0h43+zMobrLfLZRPfuBu8x7yPSUWkjegYnROcOi40CnmptJzr6AwL79m4PF9W1Y15Y3nqpPqfLXZCG+Nw= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783718634; c=relaxed/simple; bh=ZffsXEKRzy6BPrYFDZBFjLeefjvojwkwyzHgCSgBeJE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ByDxLH79LjsL3vZX7sfmQDceWMgt+03FtVceCtYPqMwiozI4pKJM9DRoVyaOt8XFQGYuu3GYfNlXR0DYWwlZ8xOVYFUH1ijWMrCWfnU+UUnno6Dh4dJkf5DBJ7iaK5Q8c6CO0fR4+HPWgyWQIz6wUFht7ma0L1CHqsOR/beeKxo= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gfiEZkVR; arc=pass smtp.client-ip=209.85.216.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gfiEZkVR" Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-38175907a56so2013741a91.0 for ; Fri, 10 Jul 2026 14:23:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1783718632; cv=none; d=google.com; s=arc-20260327; b=W6WdIqXmwGfoCGWfMYgEc8DEew+LlqUOgU/Eb52HFpik5KD9D58+jVPDu5JT2YP68L +kUYSkmp8RmdoD1cAHvmBLsju/5WcSW+rL+31QanZ65CyqTu9SbGductq3/B+fn5B+sl q+ut7QHQtpFtxTwQOr6hH01GbvX1YlRql1SR89S7JNRQDwPcW+DZc2sqoFgqUJPGZig8 wM7OMS2Z1NLwFjoIE5efeZQnMndTZvgtXlC1McNS+2eNmAjzBjDEUlGO4QDJnXKD3tPO Aj34s/J2q23Ya4cz9CwaV2xzW3DKdYpH8FehIbArxIQpOqInMiz4RhGK/7+6Zo1B4VlE 23Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=X3OYMFo4gk2Qm3Y1GCk0JrLQvP6s+kDSI3H/HQZhhkE=; fh=3+ox75Atd5qIwYu6+or4i1Pdk1I1LcDR35+GSTo5jv0=; b=IzGQVy3CjQ+R7SPHLRE22FOjuZ88TTPQM19hmNu+dML/xiyD2CJDNFhxkVeMf1LTwC ztKtsNxSN48x2PJWNjxFwbPFJgOZkEWeUdXQeylqJxX8Nz8sBHNZrAOx5GHMwopJPP1y dI3Q3BKQVJV8AIL1BUyLxBn+tWNU+3rA2IX3/N1tDN0WN6xoDPOCbZ+vnx7yHOrI2VKG qCIdxCGoSRupRhcxTy/wSb4KME/lJTxvRR0Qm/oH7n4PL6FgUADzzj1qB57Th3evBHMb MsTkIz76N5BBbt/foSJmxSdTvuObovBwKq9C6MliyAdRdwERixhv4TGWJ35wGm04/RCs 7HjQ==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783718632; x=1784323432; darn=vger.kernel.org; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:from:to:cc:subject :date:message-id:reply-to:content-type; bh=X3OYMFo4gk2Qm3Y1GCk0JrLQvP6s+kDSI3H/HQZhhkE=; b=gfiEZkVRkxY3zvcQlPbas/3Cycw47n3fcFyJ5mfu46UrrgcTvkI0356jgCEZcaZafW X6cbSUJanZS0Mo6YOChyU/8CzukJyrdbK3RXgTB3KdWymKLh2qd67PwMA3WpUcZFIW10 r6wgLSZ8WUnZACqQ8DlT2qkuqJSTPx1a/HQ0pI4+wbP48h1SofJJoDlHNaEiGr+1iRpp oSALXPlMh62CoSf+dubbQCWTGgAZMRWYEEfE+hs9vLnezx0k6tktUQL31TPkHk/465HC I7VEdO3fKkg/syWpwHvbBCjr2Ykni/j2Zgp9pmCrXJssapi1k2eceXGm5OYVZMRwLIcE ioQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783718632; x=1784323432; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=X3OYMFo4gk2Qm3Y1GCk0JrLQvP6s+kDSI3H/HQZhhkE=; b=VZsjzEOOlB2AwiGqk7gC5/iM08WdwRGPU59tL5lU8jyDrNl3KNlhmj86gjR/JmgeoS xVlDyOuWOoll7k+YZhUs0ialipsbhpFKZ4I7mUgI0Et03EQ20KoBCBOE49x0LCpckI/O 4QadnbpaI6P4edKERZ5XEk9AvSIr8u/XdXPsDEC1hoJ9bDENPQLbPN5Dujtxrp+cqzF1 /9JZliEEdz0QC4eaSk1YWI9l5G4qRs/6L6PtRa6Q/rGvyD1BQZwt0BDs0h4mbUedO4tk sRMzgeV6vQ3Dp6NYnEwFL7ydffvZF9TUKFJjRRt3Rq4Q8Aj5VTSewNAB2YWu6Mu59/Vy vWYQ== X-Forwarded-Encrypted: i=1; AHgh+RrYwEuNagURQFrmXUEL2mYlNwI3JkSEOuf5MLbNg5kshC9S3cBn2mqjKDl6j2wwd7Zq+1hdYe91g5qUZnc=@vger.kernel.org X-Gm-Message-State: AOJu0YywnuCyROz39pt0TMku1eOn+gmusF2yF/QAVYArXICyDqLGzuG7 85iDIK0q9pSzz4ZGVdVCF5KVkCY4or15MdwPuV/n0wa870XCYxo7f+b4zAlLPVv/ZOMEmz5sY5R Q2jHSfXVvUCbNZqxObXoM8x7LfroCo2g= X-Gm-Gg: AfdE7cnhI01Wr4mTkerQE34T7lVeCMV7BOHrd+dA1DAoJ4sHBZDCOVrkZ/52m6vVF5J 8Wfn2UJfohSp9fq8lQoNSAttGvOz1bNTvk37h+HvSfxDgT+puoeD6Cz8ixyeOjlc92LIH8w5d7+ ymnlGwt2Oy5i3cYGdycIosLjnoSZRHC9xBmUamR1fcmshzVypIgGK/yJax4MV4+w6fsYQuJaUCL EGJbxI28HZS7fuLPlytuRXKC8IAwN8ssmHu32EX/m4yjZnvkE+kY+R+n4pxqoczssJcvmvdFb9o RsBTcx9cg2sENpH/4n1kXjsjy44CI+fIHRtgCA3VUMPObbecO0zlvg== X-Received: by 2002:a17:90b:5903:b0:37f:9e21:91d8 with SMTP id 98e67ed59e1d1-38dc834de8fmr359486a91.15.1783718632544; Fri, 10 Jul 2026 14:23:52 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260706172744.3920417-1-puranjay@kernel.org> <20260706172744.3920417-3-puranjay@kernel.org> In-Reply-To: <20260706172744.3920417-3-puranjay@kernel.org> From: Andrii Nakryiko Date: Fri, 10 Jul 2026 14:23:39 -0700 X-Gm-Features: AVVi8CeESE7KrO4SofyyKXRIq0UuNC-RWDudhRYzrwkmSGZKKMPllM8AreG8cCk Message-ID: Subject: Re: [PATCH bpf-next 2/2] uprobes: Switch uretprobes_srcu to SRCU-fast-updown To: Puranjay Mohan Cc: Lai Jiangshan , "Paul E. McKenney" , Josh Triplett , Masami Hiramatsu , Oleg Nesterov , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexei Starovoitov , Andrii Nakryiko , Steven Rostedt , Mathieu Desnoyers , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jul 6, 2026 at 10:28=E2=80=AFAM Puranjay Mohan 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 > --- > 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 [...]