Skip to content

Commit 08d835d

Browse files
Rei YamamotoKAGA-KOKO
authored andcommitted
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: b825921 ("genirq/affinity: Spread IRQs to all available NUMA nodes") Signed-off-by: Rei Yamamoto <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Ming Lei <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent 63ef1a8 commit 08d835d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

kernel/irq/affinity.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,9 @@ static int __irq_build_affinity_masks(unsigned int startvec,
269269
*/
270270
if (numvecs <= nodes) {
271271
for_each_node_mask(n, nodemsk) {
272-
cpumask_or(&masks[curvec].mask, &masks[curvec].mask,
273-
node_to_cpumask[n]);
272+
/* Ensure that only CPUs which are in both masks are set */
273+
cpumask_and(nmsk, cpu_mask, node_to_cpumask[n]);
274+
cpumask_or(&masks[curvec].mask, &masks[curvec].mask, nmsk);
274275
if (++curvec == last_affv)
275276
curvec = firstvec;
276277
}

0 commit comments

Comments
 (0)