diff --git a/kernel-rt/centos/kernel-rt.spec b/kernel-rt/centos/kernel-rt.spec index 742dfe46..926e5fe8 100644 --- a/kernel-rt/centos/kernel-rt.spec +++ b/kernel-rt/centos/kernel-rt.spec @@ -787,6 +787,7 @@ Patch7: 0008-Allow-dmar-quirks-for-broken-bioses.patch Patch8: 0009-tpm-ignore-burstcount-to-improve-tpm_tis-send-perfor.patch Patch9: 0010-restrict-iSCSI-kthreads-to-CPUs-in-cpu_kthread_mask.patch Patch10: 0011-scsi-smartpqi-Enable-sas_address-sysfs-for-SATA-dev.patch +Patch11: 0012-workqueue-Affine-rescuer-threads-and-unbound-wqs.patch # END OF PATCH DEFINITIONS %endif diff --git a/kernel-rt/centos/patches/0012-workqueue-Affine-rescuer-threads-and-unbound-wqs.patch b/kernel-rt/centos/patches/0012-workqueue-Affine-rescuer-threads-and-unbound-wqs.patch new file mode 100644 index 00000000..0d4c3ee2 --- /dev/null +++ b/kernel-rt/centos/patches/0012-workqueue-Affine-rescuer-threads-and-unbound-wqs.patch @@ -0,0 +1,55 @@ +From 9c5c44019a17897c46a2579a50abcd69f1bcb4a8 Mon Sep 17 00:00:00 2001 +From: "M. Vefa Bicakci" +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 +Signed-off-by: Jiping Ma +--- + kernel/workqueue.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/kernel/workqueue.c b/kernel/workqueue.c +index 1e2ca744dadb..f208096f28f1 100644 +--- a/kernel/workqueue.c ++++ b/kernel/workqueue.c +@@ -4235,7 +4235,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; +@@ -5927,7 +5927,7 @@ void __init workqueue_init_early(void) + 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 + diff --git a/kernel-std/centos/kernel.spec b/kernel-std/centos/kernel.spec index 21ae0f60..4fbcf7e8 100644 --- a/kernel-std/centos/kernel.spec +++ b/kernel-std/centos/kernel.spec @@ -820,6 +820,7 @@ Patch7: 0008-Allow-dmar-quirks-for-broken-bioses.patch Patch8: 0009-tpm-ignore-burstcount-to-improve-tpm_tis-send-perfor.patch Patch9: 0010-bpf-cgroups-Fix-cgroup-v2-fallback-on-v1-v2-mixed-mo.patch Patch10: 0011-scsi-smartpqi-Enable-sas_address-sysfs-for-SATA-dev.patch +Patch11: 0012-workqueue-Affine-rescuer-threads-and-unbound-wqs.patch # END OF PATCH DEFINITIONS %endif diff --git a/kernel-std/centos/patches/0012-workqueue-Affine-rescuer-threads-and-unbound-wqs.patch b/kernel-std/centos/patches/0012-workqueue-Affine-rescuer-threads-and-unbound-wqs.patch new file mode 100644 index 00000000..0d4c3ee2 --- /dev/null +++ b/kernel-std/centos/patches/0012-workqueue-Affine-rescuer-threads-and-unbound-wqs.patch @@ -0,0 +1,55 @@ +From 9c5c44019a17897c46a2579a50abcd69f1bcb4a8 Mon Sep 17 00:00:00 2001 +From: "M. Vefa Bicakci" +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 +Signed-off-by: Jiping Ma +--- + kernel/workqueue.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/kernel/workqueue.c b/kernel/workqueue.c +index 1e2ca744dadb..f208096f28f1 100644 +--- a/kernel/workqueue.c ++++ b/kernel/workqueue.c +@@ -4235,7 +4235,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; +@@ -5927,7 +5927,7 @@ void __init workqueue_init_early(void) + 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 +