Skip to content

Commit 780818a

Browse files
paulmckrcufbq
authored andcommitted
srcu: Rename srcu_check_read_flavor_lite() to srcu_check_read_flavor_force()
This commit renames the srcu_check_read_flavor_lite() function to srcu_check_read_flavor_force() and adds a read_flavor argument in order to support an srcu_read_lock_fast() variant that is to avoid array indexing in both the lock and unlock primitives. Signed-off-by: Paul E. McKenney <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Kent Overstreet <[email protected]> Cc: <[email protected]> Signed-off-by: Boqun Feng <[email protected]>
1 parent d31e313 commit 780818a

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

include/linux/srcu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ static inline int srcu_read_lock_lite(struct srcu_struct *ssp) __acquires(ssp)
279279
{
280280
int retval;
281281

282-
srcu_check_read_flavor_lite(ssp);
282+
srcu_check_read_flavor_force(ssp, SRCU_READ_FLAVOR_LITE);
283283
retval = __srcu_read_lock_lite(ssp);
284284
rcu_try_lock_acquire(&ssp->dep_map);
285285
return retval;

include/linux/srcutiny.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static inline void srcu_barrier(struct srcu_struct *ssp)
8282
}
8383

8484
#define srcu_check_read_flavor(ssp, read_flavor) do { } while (0)
85-
#define srcu_check_read_flavor_lite(ssp) do { } while (0)
85+
#define srcu_check_read_flavor_force(ssp, read_flavor) do { } while (0)
8686

8787
/* Defined here to avoid size increase for non-torture kernels. */
8888
static inline void srcu_torture_stats_print(struct srcu_struct *ssp,

include/linux/srcutree.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,16 +251,18 @@ static inline void __srcu_read_unlock_lite(struct srcu_struct *ssp, int idx)
251251

252252
void __srcu_check_read_flavor(struct srcu_struct *ssp, int read_flavor);
253253

254-
// Record _lite() usage even for CONFIG_PROVE_RCU=n kernels.
255-
static inline void srcu_check_read_flavor_lite(struct srcu_struct *ssp)
254+
// Record reader usage even for CONFIG_PROVE_RCU=n kernels. This is
255+
// needed only for flavors that require grace-period smp_mb() calls to be
256+
// promoted to synchronize_rcu().
257+
static inline void srcu_check_read_flavor_force(struct srcu_struct *ssp, int read_flavor)
256258
{
257259
struct srcu_data *sdp = raw_cpu_ptr(ssp->sda);
258260

259-
if (likely(READ_ONCE(sdp->srcu_reader_flavor) & SRCU_READ_FLAVOR_LITE))
261+
if (likely(READ_ONCE(sdp->srcu_reader_flavor) & read_flavor))
260262
return;
261263

262264
// Note that the cmpxchg() in __srcu_check_read_flavor() is fully ordered.
263-
__srcu_check_read_flavor(ssp, SRCU_READ_FLAVOR_LITE);
265+
__srcu_check_read_flavor(ssp, read_flavor);
264266
}
265267

266268
// Record non-_lite() usage only for CONFIG_PROVE_RCU=y kernels.

0 commit comments

Comments
 (0)