代码拉取完成,页面将自动刷新
From 84a2df1c9962a87f55e1c0d3bd2118fd754a4b48 Mon Sep 17 00:00:00 2001
From: hejingxian <[email protected]>
Date: Fri, 3 Jan 2020 16:43:28 +0800
Subject: [PATCH] feature: add new irq migrate rule to avoid high cpu irq load
By the old irq migrate rule, the irqs cannot be moved if the adjustment_load will become smaller then
the min_load after moving irq. However, we can accept that the delta load become smaller after moving irq.
---
irqbalance.c | 8 +++++++-
irqbalance.h | 1 +
irqlist.c | 6 +++++-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/irqbalance.c b/irqbalance.c
index de7f4e4..ee2c988 100644
--- a/irqbalance.c
+++ b/irqbalance.c
@@ -71,6 +71,7 @@ GMainLoop *main_loop;
char *cpu_ban_string = NULL;
unsigned long migrate_ratio = 0;
+unsigned long load_limit = 0;
#ifdef HAVE_IRQBALANCEUI
int socket_fd;
@@ -111,6 +112,7 @@ struct option lopts[] = {
{"hintpolicy", 1, NULL, 'h'},
{"verifyhint", 1, NULL, 'v'},
{"notclearhint", 0, NULL, 'n'},
+ {"loadlimit", 1, NULL, 'g'},
{0, 0, 0, 0}
};
@@ -120,6 +122,7 @@ static void usage(void)
log(TO_CONSOLE, LOG_INFO, " [--powerthresh= | -p <off> | <n>] [--banirq= | -i <n>] [--banmod= | -m <module>] [--policyscript= | -l <script>]\n");
log(TO_CONSOLE, LOG_INFO, " [--pid= | -s <file>] [--deepestcache= | -c <n>] [--interval= | -t <n>] [--migrateval= | -e <n>]\n");
log(TO_CONSOLE, LOG_INFO, " [--rulesconfig= | -r <config>] [--hintpolicy | -h <subset>] [--verifyhint= | -v n] [--notclearhint | -n]\n");
+ log(TO_CONSOLE, LOG_INFO, " [--loadlimit= | -g <n>]\n");
}
static void version(void)
@@ -135,7 +138,7 @@ static void parse_command_line(int argc, char **argv)
char *endptr;
while ((opt = getopt_long(argc, argv,
- "odfjVni:p:s:c:l:m:t:e:r:h:v:",
+ "odfjVni:p:s:c:l:m:t:e:r:h:v:g:",
lopts, &longind)) != -1) {
switch(opt) {
@@ -233,6 +236,9 @@ static void parse_command_line(int argc, char **argv)
case 'n':
clear_affinity_hint = 0;
break;
+ case 'g':
+ load_limit = strtoul(optarg, NULL, 10);
+ break;
}
}
}
diff --git a/irqbalance.h b/irqbalance.h
index 710d496..e8f9fba 100644
--- a/irqbalance.h
+++ b/irqbalance.h
@@ -83,6 +83,7 @@ extern cpumask_t banned_cpus;
extern cpumask_t unbanned_cpus;
extern long HZ;
extern unsigned long migrate_ratio;
+extern unsigned long load_limit;
/*
* Numa node access routines
diff --git a/irqlist.c b/irqlist.c
index 4dd4a83..be51c0f 100644
--- a/irqlist.c
+++ b/irqlist.c
@@ -97,7 +97,11 @@ static void move_candidate_irqs(struct irq_info *info, void *data)
}
/* If we can migrate an irq without swapping the imbalance do it. */
- if ((lb_info->min_load + info->load) < delta_load + (lb_info->adjustment_load - info->load)) {
+ if ((lb_info->adjustment_load - info->load) > (lb_info->min_load + info->load)) {
+ lb_info->adjustment_load -= info->load;
+ lb_info->min_load += info->load;
+ } else if (delta_load && load_limit && (lb_info->adjustment_load > load_limit) &&
+ (lb_info->min_load + info->load) < (lb_info->adjustment_load - info->load) + delta_load) {
lb_info->adjustment_load -= info->load;
lb_info->min_load += info->load;
if (lb_info->min_load > lb_info->adjustment_load) {
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。