irqbalance/backport-Fix-socket-API-being-blocked-for-10s.patch
lihaoxiang 3945c42f79 backport community patches
Signed-off-by: langfei <langfei@huawei.com>
(cherry picked from commit 932ebb5b1d1eb8ca9cdf61de0f1e356577f588a8)
2024-05-07 21:41:40 +08:00

53 lines
1.4 KiB
Diff

From de0fe4a799c0bd62afcaf11b0ff5fc85f0b24c3e Mon Sep 17 00:00:00 2001
From: Etienne Champetier <e.champetier@ateme.com>
Date: Wed, 13 Mar 2024 15:28:37 -0400
Subject: [PATCH] Fix socket API being blocked for 10s
Instead of sleeping in scan() and blocking the main loop,
return and let the main loop call back scan().
Signed-off-by: Etienne Champetier <e.champetier@ateme.com>
---
irqbalance.c | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/irqbalance.c b/irqbalance.c
index f5f2c51..12302d7 100644
--- a/irqbalance.c
+++ b/irqbalance.c
@@ -75,20 +75,6 @@ char socket_name[64];
char *banned_cpumask_from_ui = NULL;
#endif
-static void sleep_approx(int seconds)
-{
- struct timespec ts;
- struct timeval tv;
- gettimeofday(&tv, NULL);
- ts.tv_sec = seconds;
- ts.tv_nsec = -tv.tv_usec*1000;
- while (ts.tv_nsec < 0) {
- ts.tv_sec--;
- ts.tv_nsec += 1000000000;
- }
- nanosleep(&ts, NULL);
-}
-
#ifdef HAVE_GETOPT_LONG
struct option lopts[] = {
{"oneshot", 0, NULL, 'o'},
@@ -317,9 +303,7 @@ gboolean scan(gpointer data __attribute__((unused)))
for_each_irq(NULL, force_rebalance_irq, NULL);
parse_proc_interrupts();
parse_proc_stat();
- sleep_approx(sleep_interval);
- clear_work_stats();
- parse_proc_interrupts();
+ return TRUE;
}
parse_proc_stat();
--
2.28.0.windows.1