irqbalance/backport-Avoid-repeated-affinity-checks-when-no-change-is-nec.patch
yangpan 24db4431c5 backport community patches
(cherry picked from commit c371535d450a2dff7f59c236261e3b7da14468c4)
2024-05-07 17:10:12 +08:00

41 lines
1.4 KiB
Diff

From b4c377148dda6f10a5c25be535513eeab236141f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Wed, 13 Dec 2023 20:09:34 +0100
Subject: [PATCH] Avoid repeated affinity checks when no change is necessary
An IRQ may be migrated several times during one loop iteration, and end
up with the same CPU affinity mask as before - the "moved" flag is merely
a hint a affinity change may be necessary. This notably also happens
during initial placement, but may happen also anytime later.
To avoid visiting each IRQ again and again unset the "moved" flag. This
avoids the open/stat/read/close syscalls for unchanged interrupts.
Fixes: #285
Reference: https://github.com/Irqbalance/irqbalance/commit/b4c377148dda6f10a5c25be535513eeab236141f
Conflict: NA
---
activate.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/activate.c b/activate.c
index 4830f34..724fbd5 100644
--- a/activate.c
+++ b/activate.c
@@ -68,8 +68,10 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
/*
* Don't activate anything for which we have an invalid mask
*/
- if (check_affinity(info, applied_mask))
+ if (check_affinity(info, applied_mask)) {
+ info->moved = 0; /* nothing to do, mark as done */
return;
+ }
sprintf(buf, "/proc/irq/%i/smp_affinity", info->irq);
file = fopen(buf, "w");
--
2.28.0.windows.1