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: Move attrs->cpumask out of worker_pool's properties when attrs->affn_strict

Allow more pools can be shared when attrs->affn_strict.

Signed-off-by: Lai Jiangshan <jiangshan.ljs@antgroup.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Lai Jiangshan and committed by
Tejun Heo
ae1296a7 e7cc3be6

+11 -5
+3
include/linux/workqueue.h
··· 185 185 * Below fields aren't properties of a worker_pool. They only modify how 186 186 * :c:func:`apply_workqueue_attrs` select pools and thus don't 187 187 * participate in pool hash calculations or equality comparisons. 188 + * 189 + * If @affn_strict is set, @cpumask isn't a property of a worker_pool 190 + * either. 188 191 */ 189 192 190 193 /**
+8 -5
kernel/workqueue.c
··· 4625 4625 { 4626 4626 attrs->affn_scope = WQ_AFFN_NR_TYPES; 4627 4627 attrs->ordered = false; 4628 + if (attrs->affn_strict) 4629 + cpumask_copy(attrs->cpumask, cpu_possible_mask); 4628 4630 } 4629 4631 4630 4632 /* hash value of the content of @attr */ ··· 4635 4633 u32 hash = 0; 4636 4634 4637 4635 hash = jhash_1word(attrs->nice, hash); 4638 - hash = jhash(cpumask_bits(attrs->cpumask), 4639 - BITS_TO_LONGS(nr_cpumask_bits) * sizeof(long), hash); 4636 + hash = jhash_1word(attrs->affn_strict, hash); 4640 4637 hash = jhash(cpumask_bits(attrs->__pod_cpumask), 4641 4638 BITS_TO_LONGS(nr_cpumask_bits) * sizeof(long), hash); 4642 - hash = jhash_1word(attrs->affn_strict, hash); 4639 + if (!attrs->affn_strict) 4640 + hash = jhash(cpumask_bits(attrs->cpumask), 4641 + BITS_TO_LONGS(nr_cpumask_bits) * sizeof(long), hash); 4643 4642 return hash; 4644 4643 } 4645 4644 ··· 4650 4647 { 4651 4648 if (a->nice != b->nice) 4652 4649 return false; 4653 - if (!cpumask_equal(a->cpumask, b->cpumask)) 4650 + if (a->affn_strict != b->affn_strict) 4654 4651 return false; 4655 4652 if (!cpumask_equal(a->__pod_cpumask, b->__pod_cpumask)) 4656 4653 return false; 4657 - if (a->affn_strict != b->affn_strict) 4654 + if (!a->affn_strict && !cpumask_equal(a->cpumask, b->cpumask)) 4658 4655 return false; 4659 4656 return true; 4660 4657 }