[PATCH v2] workqueue: Restrict kworker in the offline CPU pool running on housekeeping CPUs

Zqiang posted 1 patch 4 years, 2 months ago
kernel/workqueue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v2] workqueue: Restrict kworker in the offline CPU pool running on housekeeping CPUs
Posted by Zqiang 4 years, 2 months ago
When CPU going offline, all workers in this CPU pool will lose
affinity to this CPU, and may run to isolated CPU. like kworker
in unbound pool, set CPU affinity of these kworker is
wq_unbound_cpumask.

Signed-off-by: Zqiang <qiang1.zhang@intel.com>
---
 v1->v2:
 Replace housekeeping_cpumask(HK_TYPE_WQ) with wq_unbound_cpumask.

 kernel/workqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index abcc9a2ac319..b447012df177 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5023,7 +5023,7 @@ static void unbind_workers(int cpu)
 
 		for_each_pool_worker(worker, pool) {
 			kthread_set_per_cpu(worker->task, -1);
-			WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, cpu_possible_mask) < 0);
+			WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, wq_unbound_cpumask) < 0);
 		}
 
 		mutex_unlock(&wq_pool_attach_mutex);
-- 
2.25.1
Re: [PATCH v2] workqueue: Restrict kworker in the offline CPU pool running on housekeeping CPUs
Posted by Tejun Heo 4 years, 1 month ago
On Thu, Mar 31, 2022 at 01:57:17PM +0800, Zqiang wrote:
> When CPU going offline, all workers in this CPU pool will lose
> affinity to this CPU, and may run to isolated CPU. like kworker
> in unbound pool, set CPU affinity of these kworker is
> wq_unbound_cpumask.
> 
> Signed-off-by: Zqiang <qiang1.zhang@intel.com>

Applied to wq/for-5.18-fixes w/ patch description updated for clarity.

Thanks.

-- 
tejun