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

genirq/affinity: Take reserved vectors into account when spreading irqs

The recent addition of reserved vectors at the beginning or the end of the
vector space did not take the reserved vectors at the beginning into
account for the various loop exit conditions. As a consequence the last
vectors of the spread area are not included into the spread algorithm and
are treated like the reserved vectors at the end of the vector space and
get the default affinity mask assigned.

Sum up the affinity vectors and the reserved vectors at the beginning and
use the sum as exit condition.

[ tglx: Fixed all conditions instead of only one and massaged changelog ]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: http://lkml.kernel.org/r/1479201178-29604-2-git-send-email-hch@lst.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

Christoph Hellwig and committed by
Thomas Gleixner
bfe13077 0cf71b04

+5 -3
+5 -3
kernel/irq/affinity.c
··· 61 61 { 62 62 int n, nodes, vecs_per_node, cpus_per_vec, extra_vecs, curvec; 63 63 int affv = nvecs - affd->pre_vectors - affd->post_vectors; 64 + int last_affv = affv + affd->pre_vectors; 64 65 nodemask_t nodemsk = NODE_MASK_NONE; 65 66 struct cpumask *masks; 66 67 cpumask_var_t nmsk; ··· 88 87 if (affv <= nodes) { 89 88 for_each_node_mask(n, nodemsk) { 90 89 cpumask_copy(masks + curvec, cpumask_of_node(n)); 91 - if (++curvec == affv) 90 + if (++curvec == last_affv) 92 91 break; 93 92 } 94 93 goto done; ··· 108 107 /* Calculate the number of cpus per vector */ 109 108 ncpus = cpumask_weight(nmsk); 110 109 111 - for (v = 0; curvec < affv && v < vecs_to_assign; curvec++, v++) { 110 + for (v = 0; curvec < last_affv && v < vecs_to_assign; 111 + curvec++, v++) { 112 112 cpus_per_vec = ncpus / vecs_to_assign; 113 113 114 114 /* Account for extra vectors to compensate rounding errors */ ··· 121 119 irq_spread_init_one(masks + curvec, nmsk, cpus_per_vec); 122 120 } 123 121 124 - if (curvec >= affv) 122 + if (curvec >= last_affv) 125 123 break; 126 124 } 127 125