* [PATCH 0/5] Remove SRCU-lite in favor of SRCU-fast @ 2025-06-24 16:13 Paul E. McKenney 2025-06-24 16:13 ` [PATCH 2/5] rcutorture: Remove SRCU-lite scenarios Paul E. McKenney ` (5 more replies) 0 siblings, 6 replies; 14+ messages in thread From: Paul E. McKenney @ 2025-06-24 16:13 UTC (permalink / raw) To: rcu; +Cc: linux-kernel, kernel-team, rostedt Hello! This series removes the deprecated SRCU-lite flavor: 1. Remove support for SRCU-lite. 2. Remove SRCU-lite scenarios. 3. Remove support for SRCU-lite. 4. Remove SRCU-lite implementation. 5. Remove SRCU-lite deprecation. Thanx, Paul ------------------------------------------------------------------------ b/include/linux/srcu.h | 2 b/include/linux/srcutiny.h | 3 b/include/linux/srcutree.h | 38 ---------- b/kernel/rcu/rcutorture.c | 7 - b/kernel/rcu/refscale.c | 32 -------- b/scripts/checkpatch.pl | 2 b/tools/testing/selftests/rcutorture/configs/rcu/CFLIST | 1 include/linux/srcu.h | 47 ------------- tools/testing/selftests/rcutorture/configs/rcu/SRCU-L | 10 -- tools/testing/selftests/rcutorture/configs/rcu/SRCU-L.boot | 3 10 files changed, 4 insertions(+), 141 deletions(-) ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/5] rcutorture: Remove SRCU-lite scenarios 2025-06-24 16:13 [PATCH 0/5] Remove SRCU-lite in favor of SRCU-fast Paul E. McKenney @ 2025-06-24 16:13 ` Paul E. McKenney 2025-06-24 16:13 ` [PATCH 3/5] rcutorture: Remove support for SRCU-lite Paul E. McKenney ` (4 subsequent siblings) 5 siblings, 0 replies; 14+ messages in thread From: Paul E. McKenney @ 2025-06-24 16:13 UTC (permalink / raw) To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney This commit prepares for the removal of SRCU-Lite by removing the SRCU-L rcutorture scenario that tests it. Signed-off-by: Paul E. McKenney <paulmck@kernel.org> --- tools/testing/selftests/rcutorture/configs/rcu/CFLIST | 1 - tools/testing/selftests/rcutorture/configs/rcu/SRCU-L | 10 ---------- .../selftests/rcutorture/configs/rcu/SRCU-L.boot | 3 --- 3 files changed, 14 deletions(-) delete mode 100644 tools/testing/selftests/rcutorture/configs/rcu/SRCU-L delete mode 100644 tools/testing/selftests/rcutorture/configs/rcu/SRCU-L.boot diff --git a/tools/testing/selftests/rcutorture/configs/rcu/CFLIST b/tools/testing/selftests/rcutorture/configs/rcu/CFLIST index 45f572570a8c3..98b6175e5aa09 100644 --- a/tools/testing/selftests/rcutorture/configs/rcu/CFLIST +++ b/tools/testing/selftests/rcutorture/configs/rcu/CFLIST @@ -5,7 +5,6 @@ TREE04 TREE05 TREE07 TREE09 -SRCU-L SRCU-N SRCU-P SRCU-T diff --git a/tools/testing/selftests/rcutorture/configs/rcu/SRCU-L b/tools/testing/selftests/rcutorture/configs/rcu/SRCU-L deleted file mode 100644 index 3b4fa8dbef8a9..0000000000000 --- a/tools/testing/selftests/rcutorture/configs/rcu/SRCU-L +++ /dev/null @@ -1,10 +0,0 @@ -CONFIG_RCU_TRACE=n -CONFIG_SMP=y -CONFIG_NR_CPUS=6 -CONFIG_HOTPLUG_CPU=y -CONFIG_PREEMPT_NONE=y -CONFIG_PREEMPT_VOLUNTARY=n -CONFIG_PREEMPT=n -#CHECK#CONFIG_RCU_EXPERT=n -CONFIG_KPROBES=n -CONFIG_FTRACE=n diff --git a/tools/testing/selftests/rcutorture/configs/rcu/SRCU-L.boot b/tools/testing/selftests/rcutorture/configs/rcu/SRCU-L.boot deleted file mode 100644 index 0207b3138c5be..0000000000000 --- a/tools/testing/selftests/rcutorture/configs/rcu/SRCU-L.boot +++ /dev/null @@ -1,3 +0,0 @@ -rcutorture.torture_type=srcu -rcutorture.reader_flavor=0x4 -rcutorture.fwd_progress=3 -- 2.40.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/5] rcutorture: Remove support for SRCU-lite 2025-06-24 16:13 [PATCH 0/5] Remove SRCU-lite in favor of SRCU-fast Paul E. McKenney 2025-06-24 16:13 ` [PATCH 2/5] rcutorture: Remove SRCU-lite scenarios Paul E. McKenney @ 2025-06-24 16:13 ` Paul E. McKenney 2025-06-24 16:13 ` [PATCH 4/5] srcu: Remove SRCU-lite implementation Paul E. McKenney ` (3 subsequent siblings) 5 siblings, 0 replies; 14+ messages in thread From: Paul E. McKenney @ 2025-06-24 16:13 UTC (permalink / raw) To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney Because SRCU-lite is being replaced by SRCU-fast, this commit removes support for SRCU-lite from rcutorture.c Signed-off-by: Paul E. McKenney <paulmck@kernel.org> --- include/linux/srcu.h | 2 +- kernel/rcu/rcutorture.c | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/include/linux/srcu.h b/include/linux/srcu.h index 900b0d5c05f54..c20dacb563e55 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h @@ -49,7 +49,7 @@ int init_srcu_struct(struct srcu_struct *ssp); #define SRCU_READ_FLAVOR_LITE 0x4 // srcu_read_lock_lite(). #define SRCU_READ_FLAVOR_FAST 0x8 // srcu_read_lock_fast(). #define SRCU_READ_FLAVOR_ALL (SRCU_READ_FLAVOR_NORMAL | SRCU_READ_FLAVOR_NMI | \ - SRCU_READ_FLAVOR_LITE | SRCU_READ_FLAVOR_FAST) // All of the above. + SRCU_READ_FLAVOR_FAST) // All of the above. #define SRCU_READ_FLAVOR_SLOWGP (SRCU_READ_FLAVOR_LITE | SRCU_READ_FLAVOR_FAST) // Flavors requiring synchronize_rcu() // instead of smp_mb(). diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 213f23f20a64b..7a893d51d02b6 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -718,11 +718,6 @@ static int srcu_torture_read_lock(void) WARN_ON_ONCE(idx & ~0x1); ret += idx << 1; } - if (reader_flavor & SRCU_READ_FLAVOR_LITE) { - idx = srcu_read_lock_lite(srcu_ctlp); - WARN_ON_ONCE(idx & ~0x1); - ret += idx << 2; - } if (reader_flavor & SRCU_READ_FLAVOR_FAST) { scp = srcu_read_lock_fast(srcu_ctlp); idx = __srcu_ptr_to_ctr(srcu_ctlp, scp); @@ -756,8 +751,6 @@ static void srcu_torture_read_unlock(int idx) WARN_ON_ONCE((reader_flavor && (idx & ~reader_flavor)) || (!reader_flavor && (idx & ~0x1))); if (reader_flavor & SRCU_READ_FLAVOR_FAST) srcu_read_unlock_fast(srcu_ctlp, __srcu_ctr_to_ptr(srcu_ctlp, (idx & 0x8) >> 3)); - if (reader_flavor & SRCU_READ_FLAVOR_LITE) - srcu_read_unlock_lite(srcu_ctlp, (idx & 0x4) >> 2); if (reader_flavor & SRCU_READ_FLAVOR_NMI) srcu_read_unlock_nmisafe(srcu_ctlp, (idx & 0x2) >> 1); if ((reader_flavor & SRCU_READ_FLAVOR_NORMAL) || !(reader_flavor & SRCU_READ_FLAVOR_ALL)) -- 2.40.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/5] srcu: Remove SRCU-lite implementation 2025-06-24 16:13 [PATCH 0/5] Remove SRCU-lite in favor of SRCU-fast Paul E. McKenney 2025-06-24 16:13 ` [PATCH 2/5] rcutorture: Remove SRCU-lite scenarios Paul E. McKenney 2025-06-24 16:13 ` [PATCH 3/5] rcutorture: Remove support for SRCU-lite Paul E. McKenney @ 2025-06-24 16:13 ` Paul E. McKenney 2025-06-24 16:14 ` [PATCH 5/5] checkpatch: Remove SRCU-lite deprecation Paul E. McKenney ` (2 subsequent siblings) 5 siblings, 0 replies; 14+ messages in thread From: Paul E. McKenney @ 2025-06-24 16:13 UTC (permalink / raw) To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney This commit removes the SRCU-lite implementation, which has been replaced by SRCU-fast. Signed-off-by: Paul E. McKenney <paulmck@kernel.org> --- include/linux/srcu.h | 47 ++-------------------------------------- include/linux/srcutiny.h | 3 --- include/linux/srcutree.h | 38 -------------------------------- 3 files changed, 2 insertions(+), 86 deletions(-) diff --git a/include/linux/srcu.h b/include/linux/srcu.h index c20dacb563e55..cf711a0f440b2 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h @@ -46,11 +46,11 @@ int init_srcu_struct(struct srcu_struct *ssp); /* Values for SRCU Tree srcu_data ->srcu_reader_flavor, but also used by rcutorture. */ #define SRCU_READ_FLAVOR_NORMAL 0x1 // srcu_read_lock(). #define SRCU_READ_FLAVOR_NMI 0x2 // srcu_read_lock_nmisafe(). -#define SRCU_READ_FLAVOR_LITE 0x4 // srcu_read_lock_lite(). +// 0x4 // SRCU-lite is no longer with us. #define SRCU_READ_FLAVOR_FAST 0x8 // srcu_read_lock_fast(). #define SRCU_READ_FLAVOR_ALL (SRCU_READ_FLAVOR_NORMAL | SRCU_READ_FLAVOR_NMI | \ SRCU_READ_FLAVOR_FAST) // All of the above. -#define SRCU_READ_FLAVOR_SLOWGP (SRCU_READ_FLAVOR_LITE | SRCU_READ_FLAVOR_FAST) +#define SRCU_READ_FLAVOR_SLOWGP SRCU_READ_FLAVOR_FAST // Flavors requiring synchronize_rcu() // instead of smp_mb(). void __srcu_read_unlock(struct srcu_struct *ssp, int idx) __releases(ssp); @@ -299,33 +299,6 @@ static inline struct srcu_ctr __percpu *srcu_down_read_fast(struct srcu_struct * return __srcu_read_lock_fast(ssp); } -/** - * srcu_read_lock_lite - register a new reader for an SRCU-protected structure. - * @ssp: srcu_struct in which to register the new reader. - * - * Enter an SRCU read-side critical section, but for a light-weight - * smp_mb()-free reader. See srcu_read_lock() for more information. - * - * If srcu_read_lock_lite() is ever used on an srcu_struct structure, - * then none of the other flavors may be used, whether before, during, - * or after. Note that grace-period auto-expediting is disabled for _lite - * srcu_struct structures because auto-expedited grace periods invoke - * synchronize_rcu_expedited(), IPIs and all. - * - * Note that srcu_read_lock_lite() can be invoked only from those contexts - * where RCU is watching, that is, from contexts where it would be legal - * to invoke rcu_read_lock(). Otherwise, lockdep will complain. - */ -static inline int srcu_read_lock_lite(struct srcu_struct *ssp) __acquires(ssp) -{ - int retval; - - srcu_check_read_flavor_force(ssp, SRCU_READ_FLAVOR_LITE); - retval = __srcu_read_lock_lite(ssp); - rcu_try_lock_acquire(&ssp->dep_map); - return retval; -} - /** * srcu_read_lock_nmisafe - register a new reader for an SRCU-protected structure. * @ssp: srcu_struct in which to register the new reader. @@ -434,22 +407,6 @@ static inline void srcu_up_read_fast(struct srcu_struct *ssp, struct srcu_ctr __ __srcu_read_unlock_fast(ssp, scp); } -/** - * srcu_read_unlock_lite - unregister a old reader from an SRCU-protected structure. - * @ssp: srcu_struct in which to unregister the old reader. - * @idx: return value from corresponding srcu_read_lock_lite(). - * - * Exit a light-weight SRCU read-side critical section. - */ -static inline void srcu_read_unlock_lite(struct srcu_struct *ssp, int idx) - __releases(ssp) -{ - WARN_ON_ONCE(idx & ~0x1); - srcu_check_read_flavor(ssp, SRCU_READ_FLAVOR_LITE); - srcu_lock_release(&ssp->dep_map); - __srcu_read_unlock_lite(ssp, idx); -} - /** * srcu_read_unlock_nmisafe - unregister a old reader from an SRCU-protected structure. * @ssp: srcu_struct in which to unregister the old reader. diff --git a/include/linux/srcutiny.h b/include/linux/srcutiny.h index 380260317d98b..51ce25f07930e 100644 --- a/include/linux/srcutiny.h +++ b/include/linux/srcutiny.h @@ -93,9 +93,6 @@ static inline void __srcu_read_unlock_fast(struct srcu_struct *ssp, struct srcu_ __srcu_read_unlock(ssp, __srcu_ptr_to_ctr(ssp, scp)); } -#define __srcu_read_lock_lite __srcu_read_lock -#define __srcu_read_unlock_lite __srcu_read_unlock - static inline void synchronize_srcu_expedited(struct srcu_struct *ssp) { synchronize_srcu(ssp); diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h index 8bed7e6cc4c1f..bf44d8d1e69ea 100644 --- a/include/linux/srcutree.h +++ b/include/linux/srcutree.h @@ -278,44 +278,6 @@ static inline void __srcu_read_unlock_fast(struct srcu_struct *ssp, struct srcu_ RCU_LOCKDEP_WARN(!rcu_is_watching(), "RCU must be watching srcu_read_unlock_fast()."); } -/* - * Counts the new reader in the appropriate per-CPU element of the - * srcu_struct. Returns an index that must be passed to the matching - * srcu_read_unlock_lite(). - * - * Note that this_cpu_inc() is an RCU read-side critical section either - * because it disables interrupts, because it is a single instruction, - * or because it is a read-modify-write atomic operation, depending on - * the whims of the architecture. - */ -static inline int __srcu_read_lock_lite(struct srcu_struct *ssp) -{ - struct srcu_ctr __percpu *scp = READ_ONCE(ssp->srcu_ctrp); - - RCU_LOCKDEP_WARN(!rcu_is_watching(), "RCU must be watching srcu_read_lock_lite()."); - this_cpu_inc(scp->srcu_locks.counter); /* Y */ - barrier(); /* Avoid leaking the critical section. */ - return __srcu_ptr_to_ctr(ssp, scp); -} - -/* - * Removes the count for the old reader from the appropriate - * per-CPU element of the srcu_struct. Note that this may well be a - * different CPU than that which was incremented by the corresponding - * srcu_read_lock_lite(), but it must be within the same task. - * - * Note that this_cpu_inc() is an RCU read-side critical section either - * because it disables interrupts, because it is a single instruction, - * or because it is a read-modify-write atomic operation, depending on - * the whims of the architecture. - */ -static inline void __srcu_read_unlock_lite(struct srcu_struct *ssp, int idx) -{ - barrier(); /* Avoid leaking the critical section. */ - this_cpu_inc(__srcu_ctr_to_ptr(ssp, idx)->srcu_unlocks.counter); /* Z */ - RCU_LOCKDEP_WARN(!rcu_is_watching(), "RCU must be watching srcu_read_unlock_lite()."); -} - void __srcu_check_read_flavor(struct srcu_struct *ssp, int read_flavor); // Record reader usage even for CONFIG_PROVE_RCU=n kernels. This is -- 2.40.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 5/5] checkpatch: Remove SRCU-lite deprecation 2025-06-24 16:13 [PATCH 0/5] Remove SRCU-lite in favor of SRCU-fast Paul E. McKenney ` (2 preceding siblings ...) 2025-06-24 16:13 ` [PATCH 4/5] srcu: Remove SRCU-lite implementation Paul E. McKenney @ 2025-06-24 16:14 ` Paul E. McKenney [not found] ` <20250624161400.867880-1-paulmck@kernel.org> 2025-07-02 0:23 ` [PATCH v2 0/5] Remove SRCU-lite in favor of SRCU-fast Paul E. McKenney 5 siblings, 0 replies; 14+ messages in thread From: Paul E. McKenney @ 2025-06-24 16:14 UTC (permalink / raw) To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Paul E. McKenney Now that SRCU-lite has been removed from the kernel, let's remove the now-redundant deprecation from checkpatch.pl. Signed-off-by: Paul E. McKenney <paulmck@kernel.org> --- scripts/checkpatch.pl | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 664f7b7a622c2..867c7b6fd839f 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -857,8 +857,6 @@ our %deprecated_apis = ( "kunmap" => "kunmap_local", "kmap_atomic" => "kmap_local_page", "kunmap_atomic" => "kunmap_local", - "srcu_read_lock_lite" => "srcu_read_lock_fast", - "srcu_read_unlock_lite" => "srcu_read_unlock_fast", ); #Create a search pattern for all these strings to speed up a loop below -- 2.40.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
[parent not found: <20250624161400.867880-1-paulmck@kernel.org>]
* Re: [PATCH 1/5] torture: Remove support for SRCU-lite [not found] ` <20250624161400.867880-1-paulmck@kernel.org> @ 2025-06-25 12:05 ` Christoph Hellwig 2025-06-26 10:54 ` Paul E. McKenney 0 siblings, 1 reply; 14+ messages in thread From: Christoph Hellwig @ 2025-06-25 12:05 UTC (permalink / raw) To: Paul E. McKenney; +Cc: rcu, linux-kernel, kernel-team, rostedt On Tue, Jun 24, 2025 at 09:13:56AM -0700, Paul E. McKenney wrote: > Because SRCU-lite is being replaced by SRCU-fast, this commit removes > support for SRCU-lite from refscale.c. Please explain how they different and why one is a good enough (or even better?) replacement for the other. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/5] torture: Remove support for SRCU-lite 2025-06-25 12:05 ` [PATCH 1/5] torture: Remove support for SRCU-lite Christoph Hellwig @ 2025-06-26 10:54 ` Paul E. McKenney 2025-06-26 11:03 ` Christoph Hellwig 0 siblings, 1 reply; 14+ messages in thread From: Paul E. McKenney @ 2025-06-26 10:54 UTC (permalink / raw) To: Christoph Hellwig; +Cc: rcu, linux-kernel, kernel-team, rostedt On Wed, Jun 25, 2025 at 05:05:47AM -0700, Christoph Hellwig wrote: > On Tue, Jun 24, 2025 at 09:13:56AM -0700, Paul E. McKenney wrote: > > Because SRCU-lite is being replaced by SRCU-fast, this commit removes > > support for SRCU-lite from refscale.c. > > Please explain how they different and why one is a good enough (or > even better?) replacement for the other. Ah, good point, thank you! How about if I add this to the cover letter? Both SRCU-lite and SRCU-fast provide faster readers by dropping the smp_mb() call from their lock and unlock primitives. The price of this is a pair of added RCU grace periods during the SRCU grace period. SRCU-fast also adds NMI safety for architectures that have NMIs but do not have NMI-safe per-CPU operations. In addition, srcu_read_lock_fast() returns a per-CPU pointer rather than an integer, which provides a further speedup compared to SRCU-lite by getting rid of array-index calculations. There is a trivial mapping from the SRCU-lite API to that of SRCU-fast, so we do not expect any transition issues. In addition, while SRCU-lite remains in the kernel, checkpatch.pl will warn about added SRCU-lite use cases. Further read-side speedups are possible, but they amount to only about half a nanosecond out of about two nanoseconds (measured on my x86 laptop), and they might require some changes to existing SRCU code. These changes are trivial, but we need to see a solid need for the additional performance before inconveniencing existing users. Thanx, Paul ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/5] torture: Remove support for SRCU-lite 2025-06-26 10:54 ` Paul E. McKenney @ 2025-06-26 11:03 ` Christoph Hellwig 2025-06-26 14:37 ` Paul E. McKenney 0 siblings, 1 reply; 14+ messages in thread From: Christoph Hellwig @ 2025-06-26 11:03 UTC (permalink / raw) To: Paul E. McKenney Cc: Christoph Hellwig, rcu, linux-kernel, kernel-team, rostedt On Thu, Jun 26, 2025 at 03:54:06AM -0700, Paul E. McKenney wrote: > How about if I add this to the cover letter? Sounds good. But please also have a very short summary in the actual commits. As-is the commit logs completly fail explain to the why, which is the most important part of a commit log. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/5] torture: Remove support for SRCU-lite 2025-06-26 11:03 ` Christoph Hellwig @ 2025-06-26 14:37 ` Paul E. McKenney 0 siblings, 0 replies; 14+ messages in thread From: Paul E. McKenney @ 2025-06-26 14:37 UTC (permalink / raw) To: Christoph Hellwig; +Cc: rcu, linux-kernel, kernel-team, rostedt On Thu, Jun 26, 2025 at 04:03:32AM -0700, Christoph Hellwig wrote: > On Thu, Jun 26, 2025 at 03:54:06AM -0700, Paul E. McKenney wrote: > > How about if I add this to the cover letter? > > Sounds good. But please also have a very short summary in the > actual commits. As-is the commit logs completly fail explain to the > why, which is the most important part of a commit log. Will do, and again, thank you! Thanx, Paul ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 0/5] Remove SRCU-lite in favor of SRCU-fast 2025-06-24 16:13 [PATCH 0/5] Remove SRCU-lite in favor of SRCU-fast Paul E. McKenney ` (4 preceding siblings ...) [not found] ` <20250624161400.867880-1-paulmck@kernel.org> @ 2025-07-02 0:23 ` Paul E. McKenney 2025-07-02 0:23 ` [PATCH v2 1/5] torture: Remove support for SRCU-lite Paul E. McKenney ` (3 more replies) 5 siblings, 4 replies; 14+ messages in thread From: Paul E. McKenney @ 2025-07-02 0:23 UTC (permalink / raw) To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Christoph Hellwig Hello! This series removes the deprecated SRCU-lite flavor. Both SRCU-lite and SRCU-fast provide faster readers by dropping the smp_mb() call from their lock and unlock primitives. The price of this is a pair of added RCU grace periods during the SRCU grace period. SRCU-fast also adds NMI safety for architectures that have NMIs but do not have NMI-safe per-CPU operations. In addition, srcu_read_lock_fast() returns a per-CPU pointer rather than an integer, which provides a further speedup compared to SRCU-lite by getting rid of array-index calculations. There is a trivial mapping from the SRCU-lite API to that of SRCU-fast, so we do not expect any transition issues. In addition, while SRCU-lite remains in the kernel, checkpatch.pl will warn about added SRCU-lite use cases. Further read-side speedups are possible, but they amount to only about half a nanosecond out of about two nanoseconds (measured on my x86 laptop), and they might require some changes to existing SRCU code. These changes are trivial, but we need to see a solid need for the additional performance before inconveniencing existing users. 1. Remove support for SRCU-lite. 2. Remove SRCU-lite scenarios. 3. Remove support for SRCU-lite. 4. Remove SRCU-lite implementation. 5. Remove SRCU-lite deprecation. Changes since v1: o Add short explanation of SRCU-lite and SRCU-fast. Thanx, Paul ------------------------------------------------------------------------ b/include/linux/srcu.h | 2 b/include/linux/srcutiny.h | 3 b/include/linux/srcutree.h | 38 ---------- b/kernel/rcu/rcutorture.c | 7 - b/kernel/rcu/refscale.c | 32 -------- b/scripts/checkpatch.pl | 2 b/tools/testing/selftests/rcutorture/configs/rcu/CFLIST | 1 include/linux/srcu.h | 47 ------------- tools/testing/selftests/rcutorture/configs/rcu/SRCU-L | 10 -- tools/testing/selftests/rcutorture/configs/rcu/SRCU-L.boot | 3 10 files changed, 4 insertions(+), 141 deletions(-) ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 1/5] torture: Remove support for SRCU-lite 2025-07-02 0:23 ` [PATCH v2 0/5] Remove SRCU-lite in favor of SRCU-fast Paul E. McKenney @ 2025-07-02 0:23 ` Paul E. McKenney 2025-07-02 0:23 ` [PATCH v2 2/5] rcutorture: Remove SRCU-lite scenarios Paul E. McKenney ` (2 subsequent siblings) 3 siblings, 0 replies; 14+ messages in thread From: Paul E. McKenney @ 2025-07-02 0:23 UTC (permalink / raw) To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Christoph Hellwig, Paul E. McKenney Because SRCU-lite is being replaced by SRCU-fast, this commit removes support for SRCU-lite from refscale.c. Both SRCU-lite and SRCU-fast provide faster readers by dropping the smp_mb() call from their lock and unlock primitives, but incur a pair of added RCU grace periods during the SRCU grace period. There is a trivial mapping from the SRCU-lite API to that of SRCU-fast, so there should be no transition issues. [ paulmck: Apply Christoph Hellwig feedback. ] Signed-off-by: Paul E. McKenney <paulmck@kernel.org> --- kernel/rcu/refscale.c | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c index f11a7c2af778c..f4b2cea1cce5e 100644 --- a/kernel/rcu/refscale.c +++ b/kernel/rcu/refscale.c @@ -246,36 +246,6 @@ static const struct ref_scale_ops srcu_fast_ops = { .name = "srcu-fast" }; -static void srcu_lite_ref_scale_read_section(const int nloops) -{ - int i; - int idx; - - for (i = nloops; i >= 0; i--) { - idx = srcu_read_lock_lite(srcu_ctlp); - srcu_read_unlock_lite(srcu_ctlp, idx); - } -} - -static void srcu_lite_ref_scale_delay_section(const int nloops, const int udl, const int ndl) -{ - int i; - int idx; - - for (i = nloops; i >= 0; i--) { - idx = srcu_read_lock_lite(srcu_ctlp); - un_delay(udl, ndl); - srcu_read_unlock_lite(srcu_ctlp, idx); - } -} - -static const struct ref_scale_ops srcu_lite_ops = { - .init = rcu_sync_scale_init, - .readsection = srcu_lite_ref_scale_read_section, - .delaysection = srcu_lite_ref_scale_delay_section, - .name = "srcu-lite" -}; - #ifdef CONFIG_TASKS_RCU // Definitions for RCU Tasks ref scale testing: Empty read markers. @@ -1193,7 +1163,7 @@ ref_scale_init(void) long i; int firsterr = 0; static const struct ref_scale_ops *scale_ops[] = { - &rcu_ops, &srcu_ops, &srcu_fast_ops, &srcu_lite_ops, RCU_TRACE_OPS RCU_TASKS_OPS + &rcu_ops, &srcu_ops, &srcu_fast_ops, RCU_TRACE_OPS RCU_TASKS_OPS &refcnt_ops, &rwlock_ops, &rwsem_ops, &lock_ops, &lock_irq_ops, &acqrel_ops, &sched_clock_ops, &clock_ops, &jiffies_ops, &typesafe_ref_ops, &typesafe_lock_ops, &typesafe_seqlock_ops, -- 2.40.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 2/5] rcutorture: Remove SRCU-lite scenarios 2025-07-02 0:23 ` [PATCH v2 0/5] Remove SRCU-lite in favor of SRCU-fast Paul E. McKenney 2025-07-02 0:23 ` [PATCH v2 1/5] torture: Remove support for SRCU-lite Paul E. McKenney @ 2025-07-02 0:23 ` Paul E. McKenney 2025-07-02 0:23 ` [PATCH v2 4/5] srcu: Remove SRCU-lite implementation Paul E. McKenney 2025-07-02 0:23 ` [PATCH v2 5/5] checkpatch: Remove SRCU-lite deprecation Paul E. McKenney 3 siblings, 0 replies; 14+ messages in thread From: Paul E. McKenney @ 2025-07-02 0:23 UTC (permalink / raw) To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Christoph Hellwig, Paul E. McKenney This commit prepares for the removal of SRCU-Lite by removing the SRCU-L rcutorture scenario that tests it. Both SRCU-lite and SRCU-fast provide faster readers by dropping the smp_mb() call from their lock and unlock primitives, but incur a pair of added RCU grace periods during the SRCU grace period. There is a trivial mapping from the SRCU-lite API to that of SRCU-fast, so there should be no transition issues. [ paulmck: Apply Christoph Hellwig feedback. ] Signed-off-by: Paul E. McKenney <paulmck@kernel.org> --- tools/testing/selftests/rcutorture/configs/rcu/CFLIST | 1 - tools/testing/selftests/rcutorture/configs/rcu/SRCU-L | 10 ---------- .../selftests/rcutorture/configs/rcu/SRCU-L.boot | 3 --- 3 files changed, 14 deletions(-) delete mode 100644 tools/testing/selftests/rcutorture/configs/rcu/SRCU-L delete mode 100644 tools/testing/selftests/rcutorture/configs/rcu/SRCU-L.boot diff --git a/tools/testing/selftests/rcutorture/configs/rcu/CFLIST b/tools/testing/selftests/rcutorture/configs/rcu/CFLIST index 45f572570a8c3..98b6175e5aa09 100644 --- a/tools/testing/selftests/rcutorture/configs/rcu/CFLIST +++ b/tools/testing/selftests/rcutorture/configs/rcu/CFLIST @@ -5,7 +5,6 @@ TREE04 TREE05 TREE07 TREE09 -SRCU-L SRCU-N SRCU-P SRCU-T diff --git a/tools/testing/selftests/rcutorture/configs/rcu/SRCU-L b/tools/testing/selftests/rcutorture/configs/rcu/SRCU-L deleted file mode 100644 index 3b4fa8dbef8a9..0000000000000 --- a/tools/testing/selftests/rcutorture/configs/rcu/SRCU-L +++ /dev/null @@ -1,10 +0,0 @@ -CONFIG_RCU_TRACE=n -CONFIG_SMP=y -CONFIG_NR_CPUS=6 -CONFIG_HOTPLUG_CPU=y -CONFIG_PREEMPT_NONE=y -CONFIG_PREEMPT_VOLUNTARY=n -CONFIG_PREEMPT=n -#CHECK#CONFIG_RCU_EXPERT=n -CONFIG_KPROBES=n -CONFIG_FTRACE=n diff --git a/tools/testing/selftests/rcutorture/configs/rcu/SRCU-L.boot b/tools/testing/selftests/rcutorture/configs/rcu/SRCU-L.boot deleted file mode 100644 index 0207b3138c5be..0000000000000 --- a/tools/testing/selftests/rcutorture/configs/rcu/SRCU-L.boot +++ /dev/null @@ -1,3 +0,0 @@ -rcutorture.torture_type=srcu -rcutorture.reader_flavor=0x4 -rcutorture.fwd_progress=3 -- 2.40.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 4/5] srcu: Remove SRCU-lite implementation 2025-07-02 0:23 ` [PATCH v2 0/5] Remove SRCU-lite in favor of SRCU-fast Paul E. McKenney 2025-07-02 0:23 ` [PATCH v2 1/5] torture: Remove support for SRCU-lite Paul E. McKenney 2025-07-02 0:23 ` [PATCH v2 2/5] rcutorture: Remove SRCU-lite scenarios Paul E. McKenney @ 2025-07-02 0:23 ` Paul E. McKenney 2025-07-02 0:23 ` [PATCH v2 5/5] checkpatch: Remove SRCU-lite deprecation Paul E. McKenney 3 siblings, 0 replies; 14+ messages in thread From: Paul E. McKenney @ 2025-07-02 0:23 UTC (permalink / raw) To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Christoph Hellwig, Paul E. McKenney This commit removes the SRCU-lite implementation, which has been replaced by SRCU-fast. Both SRCU-lite and SRCU-fast provide faster readers by dropping the smp_mb() call from their lock and unlock primitives, but incur a pair of added RCU grace periods during the SRCU grace period. There is a trivial mapping from the SRCU-lite API to that of SRCU-fast, so there should be no transition issues. [ paulmck: Apply Christoph Hellwig feedback. ] Signed-off-by: Paul E. McKenney <paulmck@kernel.org> --- include/linux/srcu.h | 47 ++-------------------------------------- include/linux/srcutiny.h | 3 --- include/linux/srcutree.h | 38 -------------------------------- 3 files changed, 2 insertions(+), 86 deletions(-) diff --git a/include/linux/srcu.h b/include/linux/srcu.h index c20dacb563e55..cf711a0f440b2 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h @@ -46,11 +46,11 @@ int init_srcu_struct(struct srcu_struct *ssp); /* Values for SRCU Tree srcu_data ->srcu_reader_flavor, but also used by rcutorture. */ #define SRCU_READ_FLAVOR_NORMAL 0x1 // srcu_read_lock(). #define SRCU_READ_FLAVOR_NMI 0x2 // srcu_read_lock_nmisafe(). -#define SRCU_READ_FLAVOR_LITE 0x4 // srcu_read_lock_lite(). +// 0x4 // SRCU-lite is no longer with us. #define SRCU_READ_FLAVOR_FAST 0x8 // srcu_read_lock_fast(). #define SRCU_READ_FLAVOR_ALL (SRCU_READ_FLAVOR_NORMAL | SRCU_READ_FLAVOR_NMI | \ SRCU_READ_FLAVOR_FAST) // All of the above. -#define SRCU_READ_FLAVOR_SLOWGP (SRCU_READ_FLAVOR_LITE | SRCU_READ_FLAVOR_FAST) +#define SRCU_READ_FLAVOR_SLOWGP SRCU_READ_FLAVOR_FAST // Flavors requiring synchronize_rcu() // instead of smp_mb(). void __srcu_read_unlock(struct srcu_struct *ssp, int idx) __releases(ssp); @@ -299,33 +299,6 @@ static inline struct srcu_ctr __percpu *srcu_down_read_fast(struct srcu_struct * return __srcu_read_lock_fast(ssp); } -/** - * srcu_read_lock_lite - register a new reader for an SRCU-protected structure. - * @ssp: srcu_struct in which to register the new reader. - * - * Enter an SRCU read-side critical section, but for a light-weight - * smp_mb()-free reader. See srcu_read_lock() for more information. - * - * If srcu_read_lock_lite() is ever used on an srcu_struct structure, - * then none of the other flavors may be used, whether before, during, - * or after. Note that grace-period auto-expediting is disabled for _lite - * srcu_struct structures because auto-expedited grace periods invoke - * synchronize_rcu_expedited(), IPIs and all. - * - * Note that srcu_read_lock_lite() can be invoked only from those contexts - * where RCU is watching, that is, from contexts where it would be legal - * to invoke rcu_read_lock(). Otherwise, lockdep will complain. - */ -static inline int srcu_read_lock_lite(struct srcu_struct *ssp) __acquires(ssp) -{ - int retval; - - srcu_check_read_flavor_force(ssp, SRCU_READ_FLAVOR_LITE); - retval = __srcu_read_lock_lite(ssp); - rcu_try_lock_acquire(&ssp->dep_map); - return retval; -} - /** * srcu_read_lock_nmisafe - register a new reader for an SRCU-protected structure. * @ssp: srcu_struct in which to register the new reader. @@ -434,22 +407,6 @@ static inline void srcu_up_read_fast(struct srcu_struct *ssp, struct srcu_ctr __ __srcu_read_unlock_fast(ssp, scp); } -/** - * srcu_read_unlock_lite - unregister a old reader from an SRCU-protected structure. - * @ssp: srcu_struct in which to unregister the old reader. - * @idx: return value from corresponding srcu_read_lock_lite(). - * - * Exit a light-weight SRCU read-side critical section. - */ -static inline void srcu_read_unlock_lite(struct srcu_struct *ssp, int idx) - __releases(ssp) -{ - WARN_ON_ONCE(idx & ~0x1); - srcu_check_read_flavor(ssp, SRCU_READ_FLAVOR_LITE); - srcu_lock_release(&ssp->dep_map); - __srcu_read_unlock_lite(ssp, idx); -} - /** * srcu_read_unlock_nmisafe - unregister a old reader from an SRCU-protected structure. * @ssp: srcu_struct in which to unregister the old reader. diff --git a/include/linux/srcutiny.h b/include/linux/srcutiny.h index 380260317d98b..51ce25f07930e 100644 --- a/include/linux/srcutiny.h +++ b/include/linux/srcutiny.h @@ -93,9 +93,6 @@ static inline void __srcu_read_unlock_fast(struct srcu_struct *ssp, struct srcu_ __srcu_read_unlock(ssp, __srcu_ptr_to_ctr(ssp, scp)); } -#define __srcu_read_lock_lite __srcu_read_lock -#define __srcu_read_unlock_lite __srcu_read_unlock - static inline void synchronize_srcu_expedited(struct srcu_struct *ssp) { synchronize_srcu(ssp); diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h index 8bed7e6cc4c1f..bf44d8d1e69ea 100644 --- a/include/linux/srcutree.h +++ b/include/linux/srcutree.h @@ -278,44 +278,6 @@ static inline void __srcu_read_unlock_fast(struct srcu_struct *ssp, struct srcu_ RCU_LOCKDEP_WARN(!rcu_is_watching(), "RCU must be watching srcu_read_unlock_fast()."); } -/* - * Counts the new reader in the appropriate per-CPU element of the - * srcu_struct. Returns an index that must be passed to the matching - * srcu_read_unlock_lite(). - * - * Note that this_cpu_inc() is an RCU read-side critical section either - * because it disables interrupts, because it is a single instruction, - * or because it is a read-modify-write atomic operation, depending on - * the whims of the architecture. - */ -static inline int __srcu_read_lock_lite(struct srcu_struct *ssp) -{ - struct srcu_ctr __percpu *scp = READ_ONCE(ssp->srcu_ctrp); - - RCU_LOCKDEP_WARN(!rcu_is_watching(), "RCU must be watching srcu_read_lock_lite()."); - this_cpu_inc(scp->srcu_locks.counter); /* Y */ - barrier(); /* Avoid leaking the critical section. */ - return __srcu_ptr_to_ctr(ssp, scp); -} - -/* - * Removes the count for the old reader from the appropriate - * per-CPU element of the srcu_struct. Note that this may well be a - * different CPU than that which was incremented by the corresponding - * srcu_read_lock_lite(), but it must be within the same task. - * - * Note that this_cpu_inc() is an RCU read-side critical section either - * because it disables interrupts, because it is a single instruction, - * or because it is a read-modify-write atomic operation, depending on - * the whims of the architecture. - */ -static inline void __srcu_read_unlock_lite(struct srcu_struct *ssp, int idx) -{ - barrier(); /* Avoid leaking the critical section. */ - this_cpu_inc(__srcu_ctr_to_ptr(ssp, idx)->srcu_unlocks.counter); /* Z */ - RCU_LOCKDEP_WARN(!rcu_is_watching(), "RCU must be watching srcu_read_unlock_lite()."); -} - void __srcu_check_read_flavor(struct srcu_struct *ssp, int read_flavor); // Record reader usage even for CONFIG_PROVE_RCU=n kernels. This is -- 2.40.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 5/5] checkpatch: Remove SRCU-lite deprecation 2025-07-02 0:23 ` [PATCH v2 0/5] Remove SRCU-lite in favor of SRCU-fast Paul E. McKenney ` (2 preceding siblings ...) 2025-07-02 0:23 ` [PATCH v2 4/5] srcu: Remove SRCU-lite implementation Paul E. McKenney @ 2025-07-02 0:23 ` Paul E. McKenney 3 siblings, 0 replies; 14+ messages in thread From: Paul E. McKenney @ 2025-07-02 0:23 UTC (permalink / raw) To: rcu; +Cc: linux-kernel, kernel-team, rostedt, Christoph Hellwig, Paul E. McKenney Now that SRCU-lite has been removed from the kernel, let's remove the now-redundant deprecation from checkpatch.pl. Signed-off-by: Paul E. McKenney <paulmck@kernel.org> --- scripts/checkpatch.pl | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 664f7b7a622c2..867c7b6fd839f 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -857,8 +857,6 @@ our %deprecated_apis = ( "kunmap" => "kunmap_local", "kmap_atomic" => "kmap_local_page", "kunmap_atomic" => "kunmap_local", - "srcu_read_lock_lite" => "srcu_read_lock_fast", - "srcu_read_unlock_lite" => "srcu_read_unlock_fast", ); #Create a search pattern for all these strings to speed up a loop below -- 2.40.1 ^ permalink raw reply related [flat|nested] 14+ messages in thread
end of thread, other threads:[~2025-07-02 0:23 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-06-24 16:13 [PATCH 0/5] Remove SRCU-lite in favor of SRCU-fast Paul E. McKenney 2025-06-24 16:13 ` [PATCH 2/5] rcutorture: Remove SRCU-lite scenarios Paul E. McKenney 2025-06-24 16:13 ` [PATCH 3/5] rcutorture: Remove support for SRCU-lite Paul E. McKenney 2025-06-24 16:13 ` [PATCH 4/5] srcu: Remove SRCU-lite implementation Paul E. McKenney 2025-06-24 16:14 ` [PATCH 5/5] checkpatch: Remove SRCU-lite deprecation Paul E. McKenney [not found] ` <20250624161400.867880-1-paulmck@kernel.org> 2025-06-25 12:05 ` [PATCH 1/5] torture: Remove support for SRCU-lite Christoph Hellwig 2025-06-26 10:54 ` Paul E. McKenney 2025-06-26 11:03 ` Christoph Hellwig 2025-06-26 14:37 ` Paul E. McKenney 2025-07-02 0:23 ` [PATCH v2 0/5] Remove SRCU-lite in favor of SRCU-fast Paul E. McKenney 2025-07-02 0:23 ` [PATCH v2 1/5] torture: Remove support for SRCU-lite Paul E. McKenney 2025-07-02 0:23 ` [PATCH v2 2/5] rcutorture: Remove SRCU-lite scenarios Paul E. McKenney 2025-07-02 0:23 ` [PATCH v2 4/5] srcu: Remove SRCU-lite implementation Paul E. McKenney 2025-07-02 0:23 ` [PATCH v2 5/5] checkpatch: Remove SRCU-lite deprecation Paul E. McKenney
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).