Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

workqueue: set WQ_AFFN_CACHE_SHARD as the default affinity scope

Set WQ_AFFN_CACHE_SHARD as the default affinity scope for unbound
workqueues. On systems where many CPUs share one LLC, the previous
default (WQ_AFFN_CACHE) collapses all CPUs to a single worker pool,
causing heavy spinlock contention on pool->lock.

WQ_AFFN_CACHE_SHARD subdivides each LLC into smaller groups, providing
a better balance between locality and contention. Users can revert to
the previous behavior with workqueue.default_affinity_scope=cache.

On systems with 8 or fewer cores per LLC, CACHE_SHARD produces a single
shard covering the entire LLC, making it functionally identical to the
previous CACHE default. The sharding only activates when an LLC has more
than 8 cores.

Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Breno Leitao and committed by
Tejun Heo
4cdc8a73 5920d046

+1 -1
+1 -1
kernel/workqueue.c
··· 450 450 static struct kmem_cache *pwq_cache; 451 451 452 452 static struct wq_pod_type wq_pod_types[WQ_AFFN_NR_TYPES]; 453 - static enum wq_affn_scope wq_affn_dfl = WQ_AFFN_CACHE; 453 + static enum wq_affn_scope wq_affn_dfl = WQ_AFFN_CACHE_SHARD; 454 454 455 455 /* buf for wq_update_unbound_pod_attrs(), protected by CPU hotplug exclusion */ 456 456 static struct workqueue_attrs *unbound_wq_update_pwq_attrs_buf;