Skip to content

Commit

Permalink
rcu/nocb: Add option to force all call_rcu() to lazy
Browse files Browse the repository at this point in the history
This will be used in the rcu scale test, to ensure that fly-by call_rcu()s do
no cause call_rcu_lazy() CBs to be flushed to the rdp ->cblist.

Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
  • Loading branch information
joelagnel authored and intel-lab-lkp committed Jun 22, 2022
1 parent 4544143 commit 69335ba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions kernel/rcu/rcu.h
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ void do_trace_rcu_torture_read(const char *rcutorturename,
unsigned long c_old,
unsigned long c);
void rcu_gp_set_torture_wait(int duration);
void rcu_force_call_rcu_to_lazy(bool force);
#else
static inline void rcutorture_get_gp_data(enum rcutorture_type test_type,
int *flags, unsigned long *gp_seq)
Expand All @@ -490,6 +491,7 @@ void do_trace_rcu_torture_read(const char *rcutorturename,
do { } while (0)
#endif
static inline void rcu_gp_set_torture_wait(int duration) { }
static inline void rcu_force_call_rcu_to_lazy(bool force) { }
#endif

#if IS_ENABLED(CONFIG_RCU_TORTURE_TEST) || IS_MODULE(CONFIG_RCU_TORTURE_TEST)
Expand Down
11 changes: 10 additions & 1 deletion kernel/rcu/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -3171,9 +3171,18 @@ void call_rcu_lazy(struct rcu_head *head, rcu_callback_t func)
EXPORT_SYMBOL_GPL(call_rcu_lazy);
#endif

static bool force_call_rcu_to_lazy;

void rcu_force_call_rcu_to_lazy(bool force)
{
if (IS_ENABLED(CONFIG_RCU_SCALE_TEST))
WRITE_ONCE(force_call_rcu_to_lazy, force);
}
EXPORT_SYMBOL_GPL(rcu_force_call_rcu_to_lazy);

void call_rcu(struct rcu_head *head, rcu_callback_t func)
{
return __call_rcu_common(head, func, false);
return __call_rcu_common(head, func, force_call_rcu_to_lazy);

}
EXPORT_SYMBOL_GPL(call_rcu);
Expand Down

0 comments on commit 69335ba

Please sign in to comment.