Skip to content

Commit 499d7e7

Browse files
Frederic Weisbeckerfbq
authored andcommitted
rcu: Rename jiffies_till_flush to jiffies_lazy_flush
The variable name jiffies_till_flush is too generic and therefore: * It may shadow a global variable * It doesn't tell on what it operates Make the name more precise, along with the related APIs. Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Reviewed-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
1 parent 41bccc9 commit 499d7e7

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

kernel/rcu/rcu.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -543,11 +543,11 @@ enum rcutorture_type {
543543
};
544544

545545
#if defined(CONFIG_RCU_LAZY)
546-
unsigned long rcu_lazy_get_jiffies_till_flush(void);
547-
void rcu_lazy_set_jiffies_till_flush(unsigned long j);
546+
unsigned long rcu_get_jiffies_lazy_flush(void);
547+
void rcu_set_jiffies_lazy_flush(unsigned long j);
548548
#else
549-
static inline unsigned long rcu_lazy_get_jiffies_till_flush(void) { return 0; }
550-
static inline void rcu_lazy_set_jiffies_till_flush(unsigned long j) { }
549+
static inline unsigned long rcu_get_jiffies_lazy_flush(void) { return 0; }
550+
static inline void rcu_set_jiffies_lazy_flush(unsigned long j) { }
551551
#endif
552552

553553
#if defined(CONFIG_TREE_RCU)

kernel/rcu/rcuscale.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -764,9 +764,9 @@ kfree_scale_init(void)
764764

765765
if (kfree_by_call_rcu) {
766766
/* do a test to check the timeout. */
767-
orig_jif = rcu_lazy_get_jiffies_till_flush();
767+
orig_jif = rcu_get_jiffies_lazy_flush();
768768

769-
rcu_lazy_set_jiffies_till_flush(2 * HZ);
769+
rcu_set_jiffies_lazy_flush(2 * HZ);
770770
rcu_barrier();
771771

772772
jif_start = jiffies;
@@ -775,7 +775,7 @@ kfree_scale_init(void)
775775

776776
smp_cond_load_relaxed(&rcu_lazy_test1_cb_called, VAL == 1);
777777

778-
rcu_lazy_set_jiffies_till_flush(orig_jif);
778+
rcu_set_jiffies_lazy_flush(orig_jif);
779779

780780
if (WARN_ON_ONCE(jiffies_at_lazy_cb - jif_start < 2 * HZ)) {
781781
pr_alert("ERROR: call_rcu() CBs are not being lazy as expected!\n");

kernel/rcu/tree_nocb.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ static bool wake_nocb_gp(struct rcu_data *rdp, bool force)
256256
return __wake_nocb_gp(rdp_gp, rdp, force, flags);
257257
}
258258

259+
#ifdef CONFIG_RCU_LAZY
259260
/*
260261
* LAZY_FLUSH_JIFFIES decides the maximum amount of time that
261262
* can elapse before lazy callbacks are flushed. Lazy callbacks
@@ -264,21 +265,20 @@ static bool wake_nocb_gp(struct rcu_data *rdp, bool force)
264265
* left unsubmitted to RCU after those many jiffies.
265266
*/
266267
#define LAZY_FLUSH_JIFFIES (10 * HZ)
267-
static unsigned long jiffies_till_flush = LAZY_FLUSH_JIFFIES;
268+
static unsigned long jiffies_lazy_flush = LAZY_FLUSH_JIFFIES;
268269

269-
#ifdef CONFIG_RCU_LAZY
270270
// To be called only from test code.
271-
void rcu_lazy_set_jiffies_till_flush(unsigned long jif)
271+
void rcu_set_jiffies_lazy_flush(unsigned long jif)
272272
{
273-
jiffies_till_flush = jif;
273+
jiffies_lazy_flush = jif;
274274
}
275-
EXPORT_SYMBOL(rcu_lazy_set_jiffies_till_flush);
275+
EXPORT_SYMBOL(rcu_set_jiffies_lazy_flush);
276276

277-
unsigned long rcu_lazy_get_jiffies_till_flush(void)
277+
unsigned long rcu_get_jiffies_lazy_flush(void)
278278
{
279-
return jiffies_till_flush;
279+
return jiffies_lazy_flush;
280280
}
281-
EXPORT_SYMBOL(rcu_lazy_get_jiffies_till_flush);
281+
EXPORT_SYMBOL(rcu_get_jiffies_lazy_flush);
282282
#endif
283283

284284
/*
@@ -299,7 +299,7 @@ static void wake_nocb_gp_defer(struct rcu_data *rdp, int waketype,
299299
*/
300300
if (waketype == RCU_NOCB_WAKE_LAZY &&
301301
rdp->nocb_defer_wakeup == RCU_NOCB_WAKE_NOT) {
302-
mod_timer(&rdp_gp->nocb_timer, jiffies + jiffies_till_flush);
302+
mod_timer(&rdp_gp->nocb_timer, jiffies + rcu_get_jiffies_lazy_flush());
303303
WRITE_ONCE(rdp_gp->nocb_defer_wakeup, waketype);
304304
} else if (waketype == RCU_NOCB_WAKE_BYPASS) {
305305
mod_timer(&rdp_gp->nocb_timer, jiffies + 2);
@@ -482,7 +482,7 @@ static bool rcu_nocb_try_bypass(struct rcu_data *rdp, struct rcu_head *rhp,
482482
// flush ->nocb_bypass to ->cblist.
483483
if ((ncbs && !bypass_is_lazy && j != READ_ONCE(rdp->nocb_bypass_first)) ||
484484
(ncbs && bypass_is_lazy &&
485-
(time_after(j, READ_ONCE(rdp->nocb_bypass_first) + jiffies_till_flush))) ||
485+
(time_after(j, READ_ONCE(rdp->nocb_bypass_first) + rcu_get_jiffies_lazy_flush()))) ||
486486
ncbs >= qhimark) {
487487
rcu_nocb_lock(rdp);
488488
*was_alldone = !rcu_segcblist_pend_cbs(&rdp->cblist);
@@ -723,7 +723,7 @@ static void nocb_gp_wait(struct rcu_data *my_rdp)
723723
lazy_ncbs = READ_ONCE(rdp->lazy_len);
724724

725725
if (bypass_ncbs && (lazy_ncbs == bypass_ncbs) &&
726-
(time_after(j, READ_ONCE(rdp->nocb_bypass_first) + jiffies_till_flush) ||
726+
(time_after(j, READ_ONCE(rdp->nocb_bypass_first) + rcu_get_jiffies_lazy_flush()) ||
727727
bypass_ncbs > 2 * qhimark)) {
728728
flush_bypass = true;
729729
} else if (bypass_ncbs && (lazy_ncbs != bypass_ncbs) &&

0 commit comments

Comments
 (0)