Commit 08d835df authored by Rei Yamamoto's avatar Rei Yamamoto Committed by Thomas Gleixner

genirq/affinity: Consider that CPUs on nodes can be unbalanced

If CPUs on a node are offline at boot time, the number of nodes is
different when building affinity masks for present cpus and when building
affinity masks for possible cpus. This causes the following problem:

In the case that the number of vectors is less than the number of nodes
there are cases where bits of masks for present cpus are overwritten when
building masks for possible cpus.

Fix this by excluding CPUs, which are not part of the current build mask
(present/possible).

[ tglx: Massaged changelog and added comment ]

Fixes: b8259219 ("genirq/affinity: Spread IRQs to all available NUMA nodes")
Signed-off-by: default avatarRei Yamamoto <yamamoto.rei@jp.fujitsu.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20220331003309.10891-1-yamamoto.rei@jp.fujitsu.com
parent 63ef1a8a
...@@ -269,8 +269,9 @@ static int __irq_build_affinity_masks(unsigned int startvec, ...@@ -269,8 +269,9 @@ static int __irq_build_affinity_masks(unsigned int startvec,
*/ */
if (numvecs <= nodes) { if (numvecs <= nodes) {
for_each_node_mask(n, nodemsk) { for_each_node_mask(n, nodemsk) {
cpumask_or(&masks[curvec].mask, &masks[curvec].mask, /* Ensure that only CPUs which are in both masks are set */
node_to_cpumask[n]); cpumask_and(nmsk, cpu_mask, node_to_cpumask[n]);
cpumask_or(&masks[curvec].mask, &masks[curvec].mask, nmsk);
if (++curvec == last_affv) if (++curvec == last_affv)
curvec = firstvec; curvec = firstvec;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment