summaryrefslogtreecommitdiff
path: root/kernel/scftorture.c
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2020-07-03 00:15:33 +0300
committerPaul E. McKenney <paulmck@kernel.org>2020-08-25 04:38:37 +0300
commita7c072ef26644b632241d549869f10f8d2dd3b5c (patch)
treeadd86b114c6cd0b36a5f7626fff3b7fc15203652 /kernel/scftorture.c
parentde77d4da54d10df97d265e7e99112bfc2fef7d4a (diff)
downloadlinux-a7c072ef26644b632241d549869f10f8d2dd3b5c.tar.xz
scftorture: Block scftorture_invoker() kthreads for offline CPUs
Currently, CPU-hotplug operations might result in all but two of (say) 100 CPUs being offline, which in turn might result in false-positive diagnostics due to overload. This commit therefore causes scftorture_invoker() kthreads for offline CPUs to loop blocking for 200 milliseconds at a time, thus continuously adjusting the number of threads to match the number of online CPUs. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'kernel/scftorture.c')
-rw-r--r--kernel/scftorture.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/scftorture.c b/kernel/scftorture.c
index d9c01c722e2a..04d3a4279413 100644
--- a/kernel/scftorture.c
+++ b/kernel/scftorture.c
@@ -381,11 +381,14 @@ static void scftorture_invoke_one(struct scf_statistics *scfp, struct torture_ra
// smp_call_function() family of functions.
static int scftorture_invoker(void *arg)
{
+ int cpu;
DEFINE_TORTURE_RANDOM(rand);
struct scf_statistics *scfp = (struct scf_statistics *)arg;
+ bool was_offline = false;
VERBOSE_SCFTORTOUT("scftorture_invoker %d: task started", scfp->cpu);
- set_cpus_allowed_ptr(current, cpumask_of(scfp->cpu % nr_cpu_ids));
+ cpu = scfp->cpu % nr_cpu_ids;
+ set_cpus_allowed_ptr(current, cpumask_of(cpu));
set_user_nice(current, MAX_NICE);
if (holdoff)
schedule_timeout_interruptible(holdoff * HZ);
@@ -408,6 +411,14 @@ static int scftorture_invoker(void *arg)
do {
scftorture_invoke_one(scfp, &rand);
+ while (cpu_is_offline(cpu) && !torture_must_stop()) {
+ schedule_timeout_interruptible(HZ / 5);
+ was_offline = true;
+ }
+ if (was_offline) {
+ set_cpus_allowed_ptr(current, cpumask_of(cpu));
+ was_offline = false;
+ }
} while (!torture_must_stop());
VERBOSE_SCFTORTOUT("scftorture_invoker %d ended", scfp->cpu);