kernel/kernel-rt/centos/patches/0012-workqueue-Affine-rescuer-threads-and-unbound-wqs.patch
M. Vefa Bicakci a10b746f32 workqueue affinity: Remove unused variable
After commit cfe452afa565 ("workqueue: Affine rescuer threads and
unbound wqs", 2021-10-25) was merged, the kernel build process started
to emit the following compilation warning:

  kernel/workqueue.c: In function 'workqueue_init_early':
  kernel/workqueue.c:5944:6: warning: unused variable 'hk_flags' \
      [-Wunused-variable]
    int hk_flags = HK_FLAG_DOMAIN | HK_FLAG_WQ;
        ^~~~~~~~

This occurs because the aforementioned commit removes all users of the
hk_flags variable from the affected function, but does not remove the
(now) unused variable.

This commit removes the unused variable to avoid the compilation
warning.

Testing:
* An ISO image was built successfully using a monolithic build
  procedure, and the kernel build logs were inspected to verify that the
  warning is no longer emitted.

Change-Id: I622bf66716fb7bdf673a9e868b48b6979e71a3e5
Fixes: cfe452afa565 ("workqueue: Affine rescuer threads ...")
Closes-Bug: 1958143
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
2022-01-17 09:01:16 -05:00

62 lines
2.3 KiB
Diff

From 6039b821dbe26c7708537e07276316dca36c1c0f Mon Sep 17 00:00:00 2001
From: "M. Vefa Bicakci" <vefa.bicakci@windriver.com>
Date: Thu, 9 Sep 2021 04:56:46 -0400
Subject: [PATCH] workqueue: Affine rescuer threads and unbound wqs
This commit ensures that workqueue rescuer threads are affined to the
platform CPUs specified by the "kthread_cpus" kernel argument. Prior to
this commit, rescuer threads could be bound to any CPU. Rescuer threads
are described in "kernel/workqueue.c" as follows:
"Regular work processing on a pool may block trying to create a new
worker which uses GFP_KERNEL allocation which has slight chance of
developing into deadlock if some works currently on the same queue
need to be processed to satisfy the GFP_KERNEL allocation. This is
the problem rescuer solves.
When such condition is possible, the pool summons rescuers of all
workqueues which have works queued on the pool and let them process
those works so that forward progress can be guaranteed."
This commit also affines unbound workqueues to the platform CPUs instead
of the housekeeping CPUs, because the latter can be a superset of the
former.
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
---
kernel/workqueue.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 1a4151c6faa6..3e3bd8d75f3c 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -4242,7 +4242,7 @@ static int init_rescuer(struct workqueue_struct *wq)
}
wq->rescuer = rescuer;
- kthread_bind_mask(rescuer->task, cpu_possible_mask);
+ kthread_bind_mask(rescuer->task, cpu_kthread_mask);
wake_up_process(rescuer->task);
return 0;
@@ -5941,13 +5941,12 @@ static void __init wq_numa_init(void)
void __init workqueue_init_early(void)
{
int std_nice[NR_STD_WORKER_POOLS] = { 0, HIGHPRI_NICE_LEVEL };
- int hk_flags = HK_FLAG_DOMAIN | HK_FLAG_WQ;
int i, cpu;
BUILD_BUG_ON(__alignof__(struct pool_workqueue) < __alignof__(long long));
BUG_ON(!alloc_cpumask_var(&wq_unbound_cpumask, GFP_KERNEL));
- cpumask_copy(wq_unbound_cpumask, housekeeping_cpumask(hk_flags));
+ cpumask_copy(wq_unbound_cpumask, cpu_kthread_mask);
pwq_cache = KMEM_CACHE(pool_workqueue, SLAB_PANIC);
--
2.29.2