Skip to content

Commit

Permalink
irq/affinity: Fix extra vecs calculation
Browse files Browse the repository at this point in the history
This fixes a math error calculating the extra_vecs. The error assumed
only 1 cpu per vector, but the value needs to account for the actual
number of cpus per vector in order to get the correct remainder for
extra CPU assignment.

Fixes: 7bf8222 ("irq/affinity: Fix CPU spread for unbalanced nodes")
Reported-by: Xiaolong Ye <xiaolong.ye@intel.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Link: http://lkml.kernel.org/r/1492104492-19943-1-git-send-email-keith.busch@intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Keith Busch authored and Thomas Gleixner committed Apr 13, 2017
1 parent 7bf8222 commit 3412386
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/irq/affinity.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd)
vecs_to_assign = min(vecs_per_node, ncpus);

/* Account for rounding errors */
extra_vecs = ncpus - vecs_to_assign;
extra_vecs = ncpus - vecs_to_assign * (ncpus / vecs_to_assign);

for (v = 0; curvec < last_affv && v < vecs_to_assign;
curvec++, v++) {
Expand Down

0 comments on commit 3412386

Please sign in to comment.