[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210116113920.018268080@infradead.org>
Date: Sat, 16 Jan 2021 12:30:39 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: mingo@...nel.org, tglx@...utronix.de
Cc: linux-kernel@...r.kernel.org, jiangshanlai@...il.com,
valentin.schneider@....com, cai@...hat.com,
vincent.donnefort@....com, decui@...rosoft.com, paulmck@...nel.org,
vincent.guittot@...aro.org, rostedt@...dmis.org, tj@...nel.org,
peterz@...radead.org
Subject: [PATCH 6/8] workqueue: Restrict affinity change to rescuer
create_worker() will already set the right affinity using
kthread_bind_mask(), this means only the rescuer will need to change
it's affinity.
Howveer, while in cpu-hot-unplug a regular task is not allowed to run
on online&&!active as it would be pushed away quite agressively. We
need KTHREAD_IS_PER_CPU to survive in that environment.
Therefore set the affinity after getting that magic flag.
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
---
kernel/workqueue.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1849,12 +1849,6 @@ static void worker_attach_to_pool(struct
mutex_lock(&wq_pool_attach_mutex);
/*
- * set_cpus_allowed_ptr() will fail if the cpumask doesn't have any
- * online CPUs. It'll be re-applied when any of the CPUs come up.
- */
- set_cpus_allowed_ptr(worker->task, pool->attrs->cpumask);
-
- /*
* The wq_pool_attach_mutex ensures %POOL_DISASSOCIATED remains
* stable across this function. See the comments above the flag
* definition for details.
@@ -1864,6 +1858,9 @@ static void worker_attach_to_pool(struct
else
kthread_set_per_cpu(worker->task, pool->cpu);
+ if (worker->rescue_wq)
+ set_cpus_allowed_ptr(worker->task, pool->attrs->cpumask);
+
list_add_tail(&worker->node, &pool->workers);
worker->pool = pool;
Powered by blists - more mailing lists