From nobody Sat Jun 13 11:58:38 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C201372686; Thu, 7 May 2026 17:09:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778173793; cv=none; b=p79swHkoeLueGoffqluMsRz8HQ2Z4kk9obknLO764e1xKE1gSwu1I973Qf/WWU49rHcQK0Tw/sM69TFGzM7/u4VCCDr6nuxRDtUohZf7dyTs+6DiINdx86ZupEgVyFpxMbgGD7uqqEF1DTKC+EP41R5nXk2nvo7qU0t0xY9/6XU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778173793; c=relaxed/simple; bh=jDUIv5GSBmuhjUG+/Jy9X5I9h/1y72j84vtbUTmUpHk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bX/BZT0dpj6fhA7xa4+bwrxXm6UsLimZgbshPTBc8NMx4yey0N7jdOMoA7QU7nRBTGWcq4pRuasY4MLN7Umh88+cyjmmkczEobzlIH+4cbLHTcKrwdABDraYGqPpVQEG+MoTeLv9dsL0whq2BdJh7oXxDV4tlK6m8U/StqmgG44= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GXuOrhnC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GXuOrhnC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BE25C2BCC4; Thu, 7 May 2026 17:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778173793; bh=jDUIv5GSBmuhjUG+/Jy9X5I9h/1y72j84vtbUTmUpHk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GXuOrhnC++vC0uq6VVLgZfQNmhh+oYdRzrv2FI7r2xR8sfxo0u1xpCSUa0sXUWK+/ wPdGmCxjOJq3UobPsfdURzcMVXW8jrpLPRO5eaBu9D8TNcJPVpOYzOepVowtXa3ZG9 iArw96znGRdV6j57q4zedQpU/C4WiKdQH1SQp88B4lvpktnS3RonEJ+DjgrNp98vNg hRYOr2qcy4zzYqC6vtKy6YKfeAOQHvog+2OonQM+CT7oZ8H0ErtyewXgAg0M1aI5Pz d1nic68ULj/WtawkxwGZQDsfS6q/ONNC//FtQgmUMl/MBC5vjM4cZbkmLG4UEjGvL9 hufuXjC7Le0LQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id A4A53CE0863; Thu, 7 May 2026 10:09:52 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" , Vasily Gorbik , Samir , Shrikanth Hegde , Tejun Heo Subject: [PATCH 1/7] srcu: Don't queue workqueue handlers to never-online CPUs Date: Thu, 7 May 2026 10:09:44 -0700 Message-Id: <20260507170950.2040199-1-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" While an srcu_struct structure is in the midst of switching from CPU-0 to all-CPUs state, it can attempt to invoke callbacks for CPUs that have never been online. Worse yet, it can attempt in invoke callbacks for CPUs that never will be online, even including imaginary CPUs not in cpu_possible_mask. This can cause hangs on s390, which is not set up to deal with workqueue handlers being scheduled on such CPUs. This commit therefore causes Tree SRCU to refrain from queueing workqueue handlers on CPUs that have not yet (and might never) come online. Because callbacks are not invoked on CPUs that have not been online, it is an error to invoke call_srcu(), synchronize_srcu(), or synchronize_srcu_expedited() on a CPU that is not yet fully online. However, it turns out to be less code to redirect the callbacks from too-early invocations of call_srcu() than to warn about such invocations. This commit therefore also redirects callbacks queued on not-yet-fully-online CPUs to the boot CPU. Reported-by: Vasily Gorbik Fixes: 61bbcfb50514 ("srcu: Push srcu_node allocation to GP when non-preemp= tible") Signed-off-by: Paul E. McKenney Tested-by: Vasily Gorbik Tested-by: Samir Reviewed-by: Shrikanth Hegde Cc: Tejun Heo --- kernel/rcu/srcutree.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c index 0d01cd8c4b4a7b..7c2f7cc131f7ae 100644 --- a/kernel/rcu/srcutree.c +++ b/kernel/rcu/srcutree.c @@ -897,11 +897,9 @@ static void srcu_schedule_cbs_snp(struct srcu_struct *= ssp, struct srcu_node *snp { int cpu; =20 - for (cpu =3D snp->grplo; cpu <=3D snp->grphi; cpu++) { - if (!(mask & (1UL << (cpu - snp->grplo)))) - continue; - srcu_schedule_cbs_sdp(per_cpu_ptr(ssp->sda, cpu), delay); - } + for (cpu =3D snp->grplo; cpu <=3D snp->grphi; cpu++) + if ((mask & (1UL << (cpu - snp->grplo))) && rcu_cpu_beenfullyonline(cpu)) + srcu_schedule_cbs_sdp(per_cpu_ptr(ssp->sda, cpu), delay); } =20 /* @@ -1322,7 +1320,9 @@ static unsigned long srcu_gp_start_if_needed(struct s= rcu_struct *ssp, */ idx =3D __srcu_read_lock_nmisafe(ssp); ss_state =3D smp_load_acquire(&ssp->srcu_sup->srcu_size_state); - if (ss_state < SRCU_SIZE_WAIT_CALL) + // If !rcu_cpu_beenfullyonline(), interrupts are still disabled, + // so no migration is possible in either direction from this CPU. + if (ss_state < SRCU_SIZE_WAIT_CALL || !rcu_cpu_beenfullyonline(raw_smp_pr= ocessor_id())) sdp =3D per_cpu_ptr(ssp->sda, get_boot_cpu_id()); else sdp =3D raw_cpu_ptr(ssp->sda); --=20 2.40.1 From nobody Sat Jun 13 11:58:38 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C3473ECBD2; Thu, 7 May 2026 17:09:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778173793; cv=none; b=Ew2KypoPE4irrqmoZDmg10n4IuioV9Ff13A6KZvIjvWaIDVOnp5ZppLLGVcN2bslE2cuj8CaZ/WyUECQ8ygVyLyMXyGM2PxFCz/oUoTNFbQg7zJHqgGdcipBhLGIDAT05A0scbs9lddl/RdpDPRNtnuzcdEigLlIDipHI9DK7mc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778173793; c=relaxed/simple; bh=/Y++xnjbRpcunrSUKXCI4237l43LWEtuXPunx3ckXv4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UyLUCRaNlubRCpRbfnVRf0eHxzXncKcB3qfJtErnMdK2QhWG393cDjTIMZRt4BNekhzbuOtuFdvriREysuPophcKMAGccws1HjRDG69zHvfP1QwAnANPxclNf7OgrwDaZbFHOCL0LlOJPcD9QFuK0d/rUQwIl42HFvdpuocOPrc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fLzq99Fe; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fLzq99Fe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06AC3C2BCB2; Thu, 7 May 2026 17:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778173793; bh=/Y++xnjbRpcunrSUKXCI4237l43LWEtuXPunx3ckXv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fLzq99FeYhg5A100/KijSbovUApCQll/NwTLbJ/C2eecm06l4pZ5+loWWYosqb50Y fYU/fEADJ4HKzPYg+ZjzpDo0qXuI8BhEsMmKYbfoTRzpx8FPWKd3xswfylwkIfPDRs a8eTxEIjhHApV/oa5v15dFGgOZNO+o+1XYLTglnBVwcfIRk0kLpVaYWVYPwLJz/QjX xuvuYazPdwYv5O8LTD4kywzHIMi/aZ6MqxGs+doz2Nk3p3aCp3EYW3Q6WhvAc5hg4K 5W6RFrQm1JKHVUE6neF7+qngNVVi7MBRrvjZugXyjmWkyrFM6lwWJFcI2vQijFdStN nkaXQF0IDYljw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id A81C9CE0A36; Thu, 7 May 2026 10:09:52 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH 2/7] srcu: Fix kerneldoc header comment typo in srcu_down_read_fast() Date: Thu, 7 May 2026 10:09:45 -0700 Message-Id: <20260507170950.2040199-2-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" s/srcu_read_lock_safe()/srcu_read_lock_fast_updown(), there being no such thing as srcu_read_lock_safe(). Signed-off-by: Paul E. McKenney --- include/linux/srcu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/srcu.h b/include/linux/srcu.h index 81b1938512d5d1..a54ce9e808b92c 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h @@ -397,7 +397,7 @@ static inline struct srcu_ctr __percpu *srcu_read_lock_= fast_notrace(struct srcu_ * * The same srcu_struct may be used concurrently by srcu_down_read_fast() * and srcu_read_lock_fast(). However, the same definition/initialization - * requirements called out for srcu_read_lock_safe() apply. + * requirements called out for srcu_read_lock_fast_updown() apply. */ static inline struct srcu_ctr __percpu *srcu_down_read_fast(struct srcu_st= ruct *ssp) __acquires_shared(ssp) { --=20 2.40.1 From nobody Sat Jun 13 11:58:38 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C1732C21C5; Thu, 7 May 2026 17:09:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778173793; cv=none; b=iyd4Nr7DixaZpeFHFZ4rF0jbDBZH4uupcrXiPR4qY90Ke/k7gwFu/Kmqtp8RzdlHNmuWoaINf2ZMgLmjOf5gtpHainGSvgRBsF1z4DiV/+5wXg3eOw1sqKgoJIl9gW0/jW0JgKrJap6QUBOJ4w1OCJYDtKH3rsILI0XEwNe4dho= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778173793; c=relaxed/simple; bh=BnQHU3UiLfVgh8EzJY+SASyVRoECPKgyAiZaumt6cvM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Mj+3al/wu/1Eho1x0OKXmnigw4Ef3tLay8rlSQ6E+SG3WsZWaclqJAiOMYsYhpCu2cC4CyuVhvcYB5PaxQreLsEAf7ckPhLuy9XcekOfKsfhBJqNDSUm3/ggxGP4IIrqpxEbVgiQRslJ1EjFJdy7OXqRyg48HbcEDeXWX9cGFQE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=K+fMIoTK; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="K+fMIoTK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 128E8C2BCC9; Thu, 7 May 2026 17:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778173793; bh=BnQHU3UiLfVgh8EzJY+SASyVRoECPKgyAiZaumt6cvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K+fMIoTK8+cYw/K12C5AbW97Q21lKJRyLSjMaJY6M1ZF90EvTag7vtXilc0Y13812 WV6AzedmGlrUGkll8Tl5tpfJXFPEog+kdbU7iQ97UvghgWNgwepI6upwPES+UEpHJ/ 07zrt0voUQBWWfCIhE8Zhzx1usxLpYJQdJ5b5GeCDMEcVwP4a+ilM79UMAcsaEpSD2 yZwSCPiYMLsJCQe/HUPKI6aXeX0HOX1Ly+0VaZFexwhVbbwNjqeYor1PXyiCH3vX6Q EMccY3AslVgPq1VMRh1MpWCP4Sy7S3p+1fYCnWq3fqJLAMP9/Rev2Mm4xKwsRHeHq6 n6dwUXQPpYDIQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id AB2A8CE0C96; Thu, 7 May 2026 10:09:52 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" , Puranjay Mohan , Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn Subject: [PATCH 3/7] checkpatch: Undeprecate rcu_read_lock_trace() and rcu_read_unlock_trace() Date: Thu, 7 May 2026 10:09:46 -0700 Message-Id: <20260507170950.2040199-3-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" It turns out that there are BPF use cases that rely on nesting RCU Tasks Trace readers. These use cases are well-served by the old rcu_read_lock_trace() and rcu_read_unlock_trace() functions that maintain a nesting counter in the task_struct structure. But these use cases incur a performance penalty when using the shiny new rcu_read_lock_tasks_trace() and rcu_read_unlock_tasks_trace() functions, which nest in the same way that SRCU does. This means that rcu_read_lock_trace() and rcu_read_unlock_trace() will be with us for some time. Therefore, remove the checkpatch.pl deprecation. Reported-by: Puranjay Mohan Signed-off-by: Paul E. McKenney Cc: Andy Whitcroft Cc: Joe Perches Cc: Dwaipayan Ray Cc: Lukas Bulwahn --- scripts/checkpatch.pl | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 0492d6afc9a1fc..7a0aa139a2424a 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -865,8 +865,6 @@ our %deprecated_apis =3D ( "DEFINE_IDR" =3D> "DEFINE_XARRAY", "idr_init" =3D> "xa_init", "idr_init_base" =3D> "xa_init_flags", - "rcu_read_lock_trace" =3D> "rcu_read_lock_tasks_trace", - "rcu_read_unlock_trace" =3D> "rcu_read_unlock_tasks_trace", ); =20 #Create a search pattern for all these strings to speed up a loop below --=20 2.40.1 From nobody Sat Jun 13 11:58:38 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C2923EC2F4; Thu, 7 May 2026 17:09:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778173793; cv=none; b=mSCX2R1cKH84OhPly1hB1C4YbMU3KzLuQ2I71A1uyzkQstsElEMb+/1juKzv891rgA0Kd5IJo1RGk79E3oCtkuBqau5jaF6/nkIdwJ12kT1n+EziVCSiNRJ8tCHdVaTS5ckmawvEtujwziJrgvqVtFG6uPR/JnMw9lNhXTeaYeY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778173793; c=relaxed/simple; bh=q7b0mu6e3ga1tvOS64w7YkMM35W9E7PHytBUGtM1y8k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WBeA8m1wdnDc+bsSrVTkvwc45jfcAcgUJUVoSWg0N2nOjtnu/rd7/4ZdJp33ZD2guMqELdrKOUo6JgGLx77TACOFCBNKsKV8T81v91MmsWQ2IjglJ6qRTb9XNHs6JmwviEka1TCWgT5Hwd9BarxaE6MCnzBzCp0dcrfqMlbvmF0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=A/TTvBsR; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="A/TTvBsR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21050C2BCB8; Thu, 7 May 2026 17:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778173793; bh=q7b0mu6e3ga1tvOS64w7YkMM35W9E7PHytBUGtM1y8k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A/TTvBsRRYkP4hv7z/jGx6UsKzpJyirv1wMHs2+Y4CHWALUzFj+SYc0QQzOzMP6zn 5rEE967a+pElOSbz+mUJsfkEbMColOi3ht1fPOnRutw5XOZ1ncLCFP+bEApx7uusvn ljpQj+9Ol9mHZzO3Vlx2aD+KsGp8wQpUaQZhsrkR26cYQM/3Nd0WhIWLQfOkH5nZXx vtCJcW/+LSjjrviA+5hZztH0+NZlzCO+7GItXRXUlAPwVZ1SbY15s7clmjeRbMkwvh v7S6qWgLlzkL/MYusi0y0zPUopNs++GOHb8DEBMbkl+sGwjgDGJmRb5JLkECGgg7Yj j8i6vsire3MQg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id ADF7BCE0DB9; Thu, 7 May 2026 10:09:52 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" , Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn Subject: [PATCH 4/7] checkpatch: Mark rcu_read_lock_tasks_trace() and friend BPF-only Date: Thu, 7 May 2026 10:09:47 -0700 Message-Id: <20260507170950.2040199-4-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The rcu_read_lock_tasks_trace() and rcu_read_unlock_tasks_trace() functions are intended for use only by BPF. Therefore, add them to the list of functions that checkpatch complains about outside of BPF (and of course, RCU). Signed-off-by: Paul E. McKenney Cc: Andy Whitcroft Cc: Joe Perches Cc: Dwaipayan Ray Cc: Lukas Bulwahn --- scripts/checkpatch.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 7a0aa139a2424a..cc5bbd70cb843e 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -7594,12 +7594,15 @@ sub process { =20 # Complain about RCU Tasks Trace used outside of BPF (and of course, RCU). our $rcu_trace_funcs =3D qr{(?x: + rcu_read_lock_tasks_trace | rcu_read_lock_trace | rcu_read_lock_trace_held | rcu_read_unlock_trace | + rcu_read_unlock_tasks_trace | call_rcu_tasks_trace | synchronize_rcu_tasks_trace | rcu_barrier_tasks_trace | + rcu_tasks_trace_expedite_current | rcu_request_urgent_qs_task )}; our $rcu_trace_paths =3D qr{(?x: --=20 2.40.1 From nobody Sat Jun 13 11:58:38 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 695592D29C7; Thu, 7 May 2026 17:09:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778173793; cv=none; b=Daof/QJu0B/9bGLM0N0w//Om1YQiTJ7llXm8rj/PvcmMA8lWO8AMe15li9M49QZSEJ8FQyiz1PGdBDvu5gh6fhFELWHev+mn919EiQ+5tldpl0k32t16QsG4JmdFqHcktSZ49UQP7y+EPI1DW2PC7IezhuqguBE9gzwsWmLzqgo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778173793; c=relaxed/simple; bh=dn0eKgumMKWPgv8A6Qf9JhTroZyknKKkxSEsAf1Np/I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OH/BgwKEMPpdjlEEPx2qRaQSX2Zr67nqkDaLpZtzwnNtgo9zTccxubufnpFjYK6njVYx65vR/qvu8zbjLfVoiSB0O7+QfCbhmk9vTAFz9Z8wIk29LJ/G1HPVE1YEO9wOde0aA5GG1qpFKMPv3av4pILPGzhYjbYRCUO4ASM+/QE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ADIo+DZ4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ADIo+DZ4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3426CC2BCFC; Thu, 7 May 2026 17:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778173793; bh=dn0eKgumMKWPgv8A6Qf9JhTroZyknKKkxSEsAf1Np/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ADIo+DZ4om6z11BUGEMPa3hDQwcvIjknWo9I3MV/lJThyy2pEmG4j0e6x+BeqAltK EvZpdbAnld3eXf0t7Y6PyqYpAhKkfKnvjLBjl3oMJnCt+DjkyUFo6JIyj2kpDY3xip J+qm/r6/bmOHHH0zIjYJ1kRq8l+259P9jA0vcjN24yIFx8pAneaDwhshnVXMHJaaRI YjTgH3NExZp2Rkp+ahXP2bvkEDx9/oqgoSi5RV2Apo/89WAt4IktJHk613APKE8PQ3 XkmGu45TSZTVE88T7tttU2WqnPKsKoTBTqa0c95lxaViQThKRSYHFveq4PB9fIQlhz eRFOaoI6/w6wA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id B0A3DCE0F12; Thu, 7 May 2026 10:09:52 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH 5/7] rcu: Simplify rcu_do_batch() by applying clamp() Date: Thu, 7 May 2026 10:09:48 -0700 Message-Id: <20260507170950.2040199-5-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This commit replaces a nested ?: sequence with clamp(). This does not reduce the number of lines of code, but it does simplify the line that it modifies. Signed-off-by: Paul E. McKenney --- kernel/rcu/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 55df6d37145e87..e46a5124c3eb88 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -2584,7 +2584,7 @@ static void rcu_do_batch(struct rcu_data *rdp) const long npj =3D NSEC_PER_SEC / HZ; long rrn =3D READ_ONCE(rcu_resched_ns); =20 - rrn =3D rrn < NSEC_PER_MSEC ? NSEC_PER_MSEC : rrn > NSEC_PER_SEC ? NSEC_= PER_SEC : rrn; + rrn =3D clamp(rrn, NSEC_PER_MSEC, NSEC_PER_SEC); tlimit =3D local_clock() + rrn; jlimit =3D jiffies + (rrn + npj + 1) / npj; jlimit_check =3D true; --=20 2.40.1 From nobody Sat Jun 13 11:58:38 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 810A744D695; Thu, 7 May 2026 17:09:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778173793; cv=none; b=Ml9Zr754gnufMtuhG1Cyka2kwSpTkA5PsK0VxrvDS7uk7iwBTyJgrI4mRGIHkyeWL+Dg8OyPHaF2qm7JDhnZMB8otbbixmFeJOGgC07uNVzsFo+LWvKAXndV58igt/w/z2S11en9M34T+hbJx+1Pzc8m7LE0aJeJVH/kx/p50vM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778173793; c=relaxed/simple; bh=Ju+wGquknA9vH4d8msEHqAowyOOhmN7jnTkXKOHQ2O0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nHY1kx845AiKtXwQ2RQ7TiseyUVdbx+blnJatBNTiLHnRZwQ2kCjeUUZNwnpm7jF7ROOF26dQQvoOOgPzyhvqsK2+ZOQ51eVcYduTwEMZr98mkfHA84wg0JtWiBJKNE12McfF2mViIAI1j+CKSS90+SHU46/rfYsMaemm1jXbXg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qjuRflnm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qjuRflnm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63830C2BCFD; Thu, 7 May 2026 17:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778173793; bh=Ju+wGquknA9vH4d8msEHqAowyOOhmN7jnTkXKOHQ2O0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qjuRflnmp/VOnXPRZ3k8H+pAvRBgs95P7hgSMMn54LR+7xcPXVhK+aG4NxWp+mEke zjXyE8vCh3nt2rzoguaiUC9vCO5D1BIfi4GKP0yBOZW++m8riaYCdptaHtAotY0ejb GUP21KKDZvAsLM+k7CTB8gR/Lab/zZMJDP5j9AoajzERgt1NFxZqICzq/0naewPpoF 6zPi6MSZ7U67u5/XHYKrEQ0HdP9Jsio/yKF5XMckW1K9js3j4rdUW8StugzLatYO7q gZvtzp3k1df5/bUMgxvhXQaeJ8QgzdYk4A3bO6/mRe/QtB5zvq0+eGvIWSGClAzta5 lz96AcS2v0Qpw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id B2FB4CE0F1C; Thu, 7 May 2026 10:09:52 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" Subject: [PATCH 6/7] rcu: Simplify param_set_next_fqs_jiffies() by applying clamp_val() Date: Thu, 7 May 2026 10:09:49 -0700 Message-Id: <20260507170950.2040199-6-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This commit replaces a nested ?: sequence with clamp_val(). This does not reduce the number of lines of code, but it does simplify the line that it modifies. Signed-off-by: Paul E. McKenney --- kernel/rcu/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index e46a5124c3eb88..09f0cef5014c7c 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -492,7 +492,7 @@ static int param_set_next_fqs_jiffies(const char *val, = const struct kernel_param int ret =3D kstrtoul(val, 0, &j); =20 if (!ret) { - WRITE_ONCE(*(ulong *)kp->arg, (j > HZ) ? HZ : (j ?: 1)); + WRITE_ONCE(*(ulong *)kp->arg, clamp_val(j, 1, HZ)); adjust_jiffies_till_sched_qs(); } return ret; --=20 2.40.1 From nobody Sat Jun 13 11:58:38 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 798C544D001; Thu, 7 May 2026 17:09:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778173793; cv=none; b=j3KrrKqmdqimCx+tMgJte2VglLm1MNFofe3v5LloiaM5S/tXN9foTu13as+G/NySbh/xI6pefeFlK8DglUxsQJdNq7FBah0V4lf32bQlAAveUiGSHAsXhoYA0bWlb0IO3q7Mo1i91fDRxyoKjOUjm72O0PiznhOCo6c/E8cGihY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778173793; c=relaxed/simple; bh=wFT/i1ySNxXzoubSoSgzPm8HS2drPU39EeIV8Pogu1k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=F5vNkogFzWcgD39gRvccaQnOnf8c1U/iw62wHaSxIvemSAXR4XjZQpfzozkzAfp0554vLdW1wTcPz4YxvcUoP6F2HWWgkaCZFpVXf/Qr9FKfiysrg1AU6srENYUqrhnzMqFf6UKGPiEOwxDe2UyQYWgNM3UItkODmofljI5KaWI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q9FSs5KN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Q9FSs5KN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C5A8C2BCF6; Thu, 7 May 2026 17:09:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778173793; bh=wFT/i1ySNxXzoubSoSgzPm8HS2drPU39EeIV8Pogu1k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q9FSs5KNlIFlmkSHDbZ/y6t+nvSUmau9KmfzuJ4DgecbmZ4k6bekSTHKugZaEhTfV 7SmdVgRT+5cnLcVB7Ts3s84tAU//GdscUOMwaLb2hnZSq5ueQS+TllyiDlJ/tIzZtN OwWotK3QSXwC1TqPqXOHlFo0YYyGnVb8lQFJOu35OgxjoSGexjLCehhusI/1LDm8RP dMJiCWaT63gs1npGfhe5RNFj9yop14KDBKpQlhYV9YGh39nPK2qWGdR+KJhQWjQmGn v+HPgza5Kv5rzuRJzMJt1zF0jiid23MOvpIEH51z1eSkcCFlZQIP395MEj6ZvDn2rd VAge4VamSgc0g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id B5A67CE0F52; Thu, 7 May 2026 10:09:52 -0700 (PDT) From: "Paul E. McKenney" To: rcu@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, "Paul E. McKenney" , Maxim Mikityanskiy Subject: [PATCH 7/7] rcu: Document rcu_access_pointer() feeding into cmpxchg() Date: Thu, 7 May 2026 10:09:50 -0700 Message-Id: <20260507170950.2040199-7-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This commit documents the rcu_access_pointer() use case for fetching the old value of an RCU-protected pointer within a lockless updater for use by an atomic cmpxchg() operation. Reported-by: Maxim Mikityanskiy Signed-off-by: Paul E. McKenney --- include/linux/rcupdate.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index bfa765132de858..5e95acc33989b6 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -592,11 +592,13 @@ context_unsafe( \ * lockdep checks for being in an RCU read-side critical section. This is * useful when the value of this pointer is accessed, but the pointer is * not dereferenced, for example, when testing an RCU-protected pointer - * against NULL. Although rcu_access_pointer() may also be used in cases - * where update-side locks prevent the value of the pointer from changing, - * you should instead use rcu_dereference_protected() for this use case. - * Within an RCU read-side critical section, there is little reason to - * use rcu_access_pointer(). + * against NULL. Within an RCU read-side critical section, there is little + * reason to use rcu_access_pointer(). Although rcu_access_pointer() may + * also be used in cases where update-side locks prevent the value of the + * pointer from changing, you should instead use rcu_dereference_protected= () + * for this use case. It is also permissible to use rcu_access_pointer() + * within lockless updaters to obtain the old value for an atomic operatio= n, + * for example, for cmpxchg(). * * It is usually best to test the rcu_access_pointer() return value * directly in order to avoid accidental dereferences being introduced --=20 2.40.1