Skip to content

Commit 299c7d9

Browse files
committed
rcutorture: Hoist OOM registry up one level
Currently, registering and unregistering the OOM notifier is done right before and after the test, respectively. This will not work well for multi-threaded tests, so this commit hoists this registering and unregistering up into the rcu_torture_fwd_prog_init() and rcu_torture_fwd_prog_cleanup() functions. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
1 parent 58db578 commit 299c7d9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

kernel/rcu/rcutorture.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2110,13 +2110,11 @@ static int rcu_torture_fwd_prog(void *args)
21102110
do {
21112111
schedule_timeout_interruptible(fwd_progress_holdoff * HZ);
21122112
WRITE_ONCE(rcu_fwd_emergency_stop, false);
2113-
register_oom_notifier(&rcutorture_oom_nb);
21142113
if (!IS_ENABLED(CONFIG_TINY_RCU) ||
21152114
rcu_inkernel_boot_has_ended())
21162115
rcu_torture_fwd_prog_nr(rfp, &tested, &tested_tries);
21172116
if (rcu_inkernel_boot_has_ended())
21182117
rcu_torture_fwd_prog_cr(rfp);
2119-
unregister_oom_notifier(&rcutorture_oom_nb);
21202118

21212119
/* Avoid slow periods, better to test when busy. */
21222120
stutter_wait("rcu_torture_fwd_prog");
@@ -2159,6 +2157,7 @@ static int __init rcu_torture_fwd_prog_init(void)
21592157
mutex_lock(&rcu_fwd_mutex);
21602158
rcu_fwds = rfp;
21612159
mutex_unlock(&rcu_fwd_mutex);
2160+
register_oom_notifier(&rcutorture_oom_nb);
21622161
return torture_create_kthread(rcu_torture_fwd_prog, rfp, fwd_prog_task);
21632162
}
21642163

@@ -2171,6 +2170,7 @@ static void rcu_torture_fwd_prog_cleanup(void)
21712170
mutex_lock(&rcu_fwd_mutex);
21722171
rcu_fwds = NULL;
21732172
mutex_unlock(&rcu_fwd_mutex);
2173+
unregister_oom_notifier(&rcutorture_oom_nb);
21742174
kfree(rfp);
21752175
}
21762176

0 commit comments

Comments
 (0)