linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] irq/affinity: Fix extra vecs calculation
@ 2017-04-13 17:28 Keith Busch
  2017-04-13 21:46 ` [tip:irq/urgent] " tip-bot for Keith Busch
  2017-04-19 16:20 ` Andrei Vagin
  0 siblings, 2 replies; 9+ messages in thread
From: Keith Busch @ 2017-04-13 17:28 UTC (permalink / raw)
  To: linux-kernel, Thomas Gleixner; +Cc: Xiaolong Ye, Keith Busch

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: 7bf8222b9bd0 ("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>
---
 kernel/irq/affinity.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
index dc52911..d052947 100644
--- a/kernel/irq/affinity.c
+++ b/kernel/irq/affinity.c
@@ -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++) {
-- 
2.7.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-04-19 22:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-13 17:28 [PATCH] irq/affinity: Fix extra vecs calculation Keith Busch
2017-04-13 21:46 ` [tip:irq/urgent] " tip-bot for Keith Busch
2017-04-19 16:20 ` Andrei Vagin
2017-04-19 17:03   ` Keith Busch
2017-04-19 19:11     ` Andrei Vagin
2017-04-19 19:53     ` Andrei Vagin
2017-04-19 21:53       ` Keith Busch
2017-04-19 22:32         ` Andrei Vagin
2017-04-19 22:45           ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).