rcutorture: Force on tick for readers and callback flooders
Readers and callback flooders in the rcutorture stress-test suite run for extended time periods by design. They do take pains to relinquish the CPU from time to time, but in some cases this relies on the scheduler being active, which in turn relies on the scheduler-clock interrupt firing from time to time. This commit therefore forces scheduling-clock interrupts within these loops. While in the area, this commit also prevents rcu_torture_reader()'s occasional timed sleeps from delaying shutdown. [ paulmck: Apply Joel Fernandes TICK_DEP_MASK_RCU->TICK_DEP_BIT_RCU fix. ] Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
Родитель
6a949b7af8
Коммит
d38e6dc6ed
|
@ -44,6 +44,7 @@
|
||||||
#include <linux/sched/debug.h>
|
#include <linux/sched/debug.h>
|
||||||
#include <linux/sched/sysctl.h>
|
#include <linux/sched/sysctl.h>
|
||||||
#include <linux/oom.h>
|
#include <linux/oom.h>
|
||||||
|
#include <linux/tick.h>
|
||||||
|
|
||||||
#include "rcu.h"
|
#include "rcu.h"
|
||||||
|
|
||||||
|
@ -1363,15 +1364,15 @@ rcu_torture_reader(void *arg)
|
||||||
set_user_nice(current, MAX_NICE);
|
set_user_nice(current, MAX_NICE);
|
||||||
if (irqreader && cur_ops->irq_capable)
|
if (irqreader && cur_ops->irq_capable)
|
||||||
timer_setup_on_stack(&t, rcu_torture_timer, 0);
|
timer_setup_on_stack(&t, rcu_torture_timer, 0);
|
||||||
|
tick_dep_set_task(current, TICK_DEP_BIT_RCU);
|
||||||
do {
|
do {
|
||||||
if (irqreader && cur_ops->irq_capable) {
|
if (irqreader && cur_ops->irq_capable) {
|
||||||
if (!timer_pending(&t))
|
if (!timer_pending(&t))
|
||||||
mod_timer(&t, jiffies + 1);
|
mod_timer(&t, jiffies + 1);
|
||||||
}
|
}
|
||||||
if (!rcu_torture_one_read(&rand))
|
if (!rcu_torture_one_read(&rand) && !torture_must_stop())
|
||||||
schedule_timeout_interruptible(HZ);
|
schedule_timeout_interruptible(HZ);
|
||||||
if (time_after(jiffies, lastsleep)) {
|
if (time_after(jiffies, lastsleep) && !torture_must_stop()) {
|
||||||
schedule_timeout_interruptible(1);
|
schedule_timeout_interruptible(1);
|
||||||
lastsleep = jiffies + 10;
|
lastsleep = jiffies + 10;
|
||||||
}
|
}
|
||||||
|
@ -1383,6 +1384,7 @@ rcu_torture_reader(void *arg)
|
||||||
del_timer_sync(&t);
|
del_timer_sync(&t);
|
||||||
destroy_timer_on_stack(&t);
|
destroy_timer_on_stack(&t);
|
||||||
}
|
}
|
||||||
|
tick_dep_clear_task(current, TICK_DEP_BIT_RCU);
|
||||||
torture_kthread_stopping("rcu_torture_reader");
|
torture_kthread_stopping("rcu_torture_reader");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1729,10 +1731,10 @@ static void rcu_torture_fwd_prog_cond_resched(unsigned long iter)
|
||||||
// Real call_rcu() floods hit userspace, so emulate that.
|
// Real call_rcu() floods hit userspace, so emulate that.
|
||||||
if (need_resched() || (iter & 0xfff))
|
if (need_resched() || (iter & 0xfff))
|
||||||
schedule();
|
schedule();
|
||||||
} else {
|
return;
|
||||||
// No userspace emulation: CB invocation throttles call_rcu()
|
|
||||||
cond_resched();
|
|
||||||
}
|
}
|
||||||
|
// No userspace emulation: CB invocation throttles call_rcu()
|
||||||
|
cond_resched();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1865,6 +1867,7 @@ static void rcu_torture_fwd_prog_cr(void)
|
||||||
cver = READ_ONCE(rcu_torture_current_version);
|
cver = READ_ONCE(rcu_torture_current_version);
|
||||||
gps = cur_ops->get_gp_seq();
|
gps = cur_ops->get_gp_seq();
|
||||||
rcu_launder_gp_seq_start = gps;
|
rcu_launder_gp_seq_start = gps;
|
||||||
|
tick_dep_set_task(current, TICK_DEP_BIT_RCU);
|
||||||
while (time_before(jiffies, stopat) &&
|
while (time_before(jiffies, stopat) &&
|
||||||
!shutdown_time_arrived() &&
|
!shutdown_time_arrived() &&
|
||||||
!READ_ONCE(rcu_fwd_emergency_stop) && !torture_must_stop()) {
|
!READ_ONCE(rcu_fwd_emergency_stop) && !torture_must_stop()) {
|
||||||
|
@ -1911,6 +1914,7 @@ static void rcu_torture_fwd_prog_cr(void)
|
||||||
rcu_torture_fwd_cb_hist();
|
rcu_torture_fwd_cb_hist();
|
||||||
}
|
}
|
||||||
schedule_timeout_uninterruptible(HZ); /* Let CBs drain. */
|
schedule_timeout_uninterruptible(HZ); /* Let CBs drain. */
|
||||||
|
tick_dep_clear_task(current, TICK_DEP_BIT_RCU);
|
||||||
WRITE_ONCE(rcu_fwd_cb_nodelay, false);
|
WRITE_ONCE(rcu_fwd_cb_nodelay, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче