Skip to content

Commit 79ba7ff

Browse files
committed
rcutorture: Emulate dyntick aspect of userspace nohz_full sojourn
During an actual call_rcu() flood, there would be frequent trips to userspace (in-kernel call_rcu() floods must be otherwise housebroken). Userspace execution on nohz_full CPUs implies an RCU dyntick idle/not-idle transition pair, so this commit adds emulation of that pair. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 9692668 commit 79ba7ff

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

include/linux/rcutiny.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ static inline void rcu_scheduler_starting(void) { }
8484
#endif /* #else #ifndef CONFIG_SRCU */
8585
static inline void rcu_end_inkernel_boot(void) { }
8686
static inline bool rcu_is_watching(void) { return true; }
87+
static inline void rcu_momentary_dyntick_idle(void) { }
8788

8889
/* Avoid RCU read-side critical sections leaking across. */
8990
static inline void rcu_all_qs(void) { barrier(); }

kernel/rcu/rcutorture.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,6 +1761,11 @@ static unsigned long rcu_torture_fwd_prog_cbfree(void)
17611761
kfree(rfcp);
17621762
freed++;
17631763
rcu_torture_fwd_prog_cond_resched(freed);
1764+
if (tick_nohz_full_enabled()) {
1765+
local_irq_save(flags);
1766+
rcu_momentary_dyntick_idle();
1767+
local_irq_restore(flags);
1768+
}
17641769
}
17651770
return freed;
17661771
}
@@ -1835,6 +1840,7 @@ static void rcu_torture_fwd_prog_nr(int *tested, int *tested_tries)
18351840
static void rcu_torture_fwd_prog_cr(void)
18361841
{
18371842
unsigned long cver;
1843+
unsigned long flags;
18381844
unsigned long gps;
18391845
int i;
18401846
long n_launders;
@@ -1894,6 +1900,11 @@ static void rcu_torture_fwd_prog_cr(void)
18941900
}
18951901
cur_ops->call(&rfcp->rh, rcu_torture_fwd_cb_cr);
18961902
rcu_torture_fwd_prog_cond_resched(n_launders + n_max_cbs);
1903+
if (tick_nohz_full_enabled()) {
1904+
local_irq_save(flags);
1905+
rcu_momentary_dyntick_idle();
1906+
local_irq_restore(flags);
1907+
}
18971908
}
18981909
stoppedat = jiffies;
18991910
n_launders_cb_snap = READ_ONCE(n_launders_cb);

kernel/rcu/tree.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ void rcu_momentary_dyntick_idle(void)
375375
WARN_ON_ONCE(!(special & RCU_DYNTICK_CTRL_CTR));
376376
rcu_preempt_deferred_qs(current);
377377
}
378+
EXPORT_SYMBOL_GPL(rcu_momentary_dyntick_idle);
378379

379380
/**
380381
* rcu_is_cpu_rrupt_from_idle - see if interrupted from idle

0 commit comments

Comments
 (0)