workqueue: Affine unbound workqueues to little CPUs by default

Although unbound workqueues are eligible to run their workers on any
CPU, the workqueue subsystem prefers scheduling workers onto the CPU
which queues them. This results in unbound workers consuming valuable
CPU time on the big and prime CPU clusters.

We can alleviate the burden of kernel housekeeping on the more important
CPUs by moving the unbound workqueues to the little CPU cluster by
default. This may also reduce power consumption, which is a plus.

Fix Warning:
kernel/workqueue.c:5765:6: warning: unused variable 'hk_flags' [-Wunused-variable]
        int hk_flags = HK_FLAG_DOMAIN | HK_FLAG_WQ;
[spak]

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
This commit is contained in:
Sultan Alsawaf 2021-01-28 17:07:14 -08:00 committed by spakkkk
parent ae14413b9d
commit 5cfb51a3e7

View File

@ -5821,13 +5821,13 @@ static void __init wq_numa_init(void)
int __init workqueue_init_early(void) int __init workqueue_init_early(void)
{ {
int std_nice[NR_STD_WORKER_POOLS] = { 0, HIGHPRI_NICE_LEVEL }; int std_nice[NR_STD_WORKER_POOLS] = { 0, HIGHPRI_NICE_LEVEL };
int hk_flags = HK_FLAG_DOMAIN | HK_FLAG_WQ; int hk_flags __maybe_unused = HK_FLAG_DOMAIN | HK_FLAG_WQ;
int i, cpu; int i, cpu;
WARN_ON(__alignof__(struct pool_workqueue) < __alignof__(long long)); WARN_ON(__alignof__(struct pool_workqueue) < __alignof__(long long));
BUG_ON(!alloc_cpumask_var(&wq_unbound_cpumask, GFP_KERNEL)); 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_lp_mask);
pwq_cache = KMEM_CACHE(pool_workqueue, SLAB_PANIC); pwq_cache = KMEM_CACHE(pool_workqueue, SLAB_PANIC);