linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] workqueue: Restrict kworker in the offline CPU pool running on housekeeping CPUs
@ 2022-03-29  5:17 Zqiang
  2022-03-31  4:22 ` Lai Jiangshan
  0 siblings, 1 reply; 2+ messages in thread
From: Zqiang @ 2022-03-29  5:17 UTC (permalink / raw)
  To: tj, jiangshanlai; +Cc: linux-kernel

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 housekeeping
cpumask.

Signed-off-by: Zqiang <qiang1.zhang@intel.com>
---
 kernel/workqueue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index abcc9a2ac319..c509ce73a783 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5023,7 +5023,8 @@ 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,
+						housekeeping_cpumask(HK_TYPE_WQ)) < 0);
 		}
 
 		mutex_unlock(&wq_pool_attach_mutex);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] workqueue: Restrict kworker in the offline CPU pool running on housekeeping CPUs
  2022-03-29  5:17 [PATCH] workqueue: Restrict kworker in the offline CPU pool running on housekeeping CPUs Zqiang
@ 2022-03-31  4:22 ` Lai Jiangshan
  0 siblings, 0 replies; 2+ messages in thread
From: Lai Jiangshan @ 2022-03-31  4:22 UTC (permalink / raw)
  To: Zqiang; +Cc: Tejun Heo, LKML

Acked-by: Lai Jiangshan <jiangshanlai@gmail.com>

I don't think the patch can be applied to the wq tree due to
the change
https://lore.kernel.org/lkml/164512420798.16921.1042432342597886877.tip-bot2@tip-bot2/
which did the rename of HK_TYPE_WQ has not been merged into Linus's tree.

On Tue, Mar 29, 2022 at 1:16 PM Zqiang <qiang1.zhang@intel.com> 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 housekeeping
> cpumask.
>
> Signed-off-by: Zqiang <qiang1.zhang@intel.com>
> ---
>  kernel/workqueue.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index abcc9a2ac319..c509ce73a783 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -5023,7 +5023,8 @@ 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,
> +                                               housekeeping_cpumask(HK_TYPE_WQ)) < 0);
>                 }
>
>                 mutex_unlock(&wq_pool_attach_mutex);
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-31  4:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-29  5:17 [PATCH] workqueue: Restrict kworker in the offline CPU pool running on housekeeping CPUs Zqiang
2022-03-31  4:22 ` Lai Jiangshan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).