Skip to content

Commit 64bdaf9

Browse files
Sebastian Andrzej Siewiorpaulmckrcu
authored andcommitted
scftorture: Move memory allocation outside of preempt_disable region.
Memory allocations can not happen within regions with explicit disabled preemption PREEMPT_RT. The problem is that the locking structures underneath are sleeping locks. Move the memory allocation outside of the preempt-disabled section. Keep the GFP_ATOMIC for the allocation to behave like a "ememergncy allocation". Tested-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Reviewed-by: Boqun Feng <boqun.feng@gmail.com> Tested-by: Boqun Feng <boqun.feng@gmail.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
1 parent 43082cd commit 64bdaf9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

kernel/scftorture.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,6 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra
320320
struct scf_check *scfcp = NULL;
321321
struct scf_selector *scfsp = scf_sel_rand(trsp);
322322

323-
if (use_cpus_read_lock)
324-
cpus_read_lock();
325-
else
326-
preempt_disable();
327323
if (scfsp->scfs_prim == SCF_PRIM_SINGLE || scfsp->scfs_wait) {
328324
scfcp = kmalloc(sizeof(*scfcp), GFP_ATOMIC);
329325
if (!scfcp) {
@@ -337,6 +333,10 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra
337333
scfcp->scfc_rpc = false;
338334
}
339335
}
336+
if (use_cpus_read_lock)
337+
cpus_read_lock();
338+
else
339+
preempt_disable();
340340
switch (scfsp->scfs_prim) {
341341
case SCF_PRIM_RESCHED:
342342
if (IS_BUILTIN(CONFIG_SCF_TORTURE_TEST)) {

0 commit comments

Comments
 (0)