diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2024-11-08 11:39:33 +0100 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2024-11-09 09:00:46 -0800 |
commit | 64bdaf963c3ac04a67c8491bea2d0ecfc7d5da96 (patch) | |
tree | 891d61eae87d1f23bed6470cc132f42d15ee1588 | |
parent | 43082cd579fbeea2ed90982f1c875bbdb2bcad2e (diff) | |
download | linux-64bdaf963c3ac04a67c8491bea2d0ecfc7d5da96.tar.gz linux-64bdaf963c3ac04a67c8491bea2d0ecfc7d5da96.tar.bz2 linux-64bdaf963c3ac04a67c8491bea2d0ecfc7d5da96.zip |
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>
-rw-r--r-- | kernel/scftorture.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/kernel/scftorture.c b/kernel/scftorture.c index 654702f75c54..e3c60f6dd547 100644 --- a/kernel/scftorture.c +++ b/kernel/scftorture.c @@ -320,10 +320,6 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra struct scf_check *scfcp = NULL; struct scf_selector *scfsp = scf_sel_rand(trsp); - if (use_cpus_read_lock) - cpus_read_lock(); - else - preempt_disable(); if (scfsp->scfs_prim == SCF_PRIM_SINGLE || scfsp->scfs_wait) { scfcp = kmalloc(sizeof(*scfcp), GFP_ATOMIC); if (!scfcp) { @@ -337,6 +333,10 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra scfcp->scfc_rpc = false; } } + if (use_cpus_read_lock) + cpus_read_lock(); + else + preempt_disable(); switch (scfsp->scfs_prim) { case SCF_PRIM_RESCHED: if (IS_BUILTIN(CONFIG_SCF_TORTURE_TEST)) { |