Merge pull request #146 from hejingxian123/trust_dev
improve irq migrating rule to avoid high cpu irq load
This commit is contained in:
commit
c50fc834f6
|
@ -67,6 +67,7 @@ GMainLoop *main_loop;
|
||||||
|
|
||||||
char *cpu_ban_string = NULL;
|
char *cpu_ban_string = NULL;
|
||||||
char *banned_cpumask_from_ui = NULL;
|
char *banned_cpumask_from_ui = NULL;
|
||||||
|
unsigned long migrate_ratio = 0;
|
||||||
|
|
||||||
static void sleep_approx(int seconds)
|
static void sleep_approx(int seconds)
|
||||||
{
|
{
|
||||||
|
@ -96,6 +97,7 @@ struct option lopts[] = {
|
||||||
{"banmod", 1 , NULL, 'm'},
|
{"banmod", 1 , NULL, 'm'},
|
||||||
{"interval", 1 , NULL, 't'},
|
{"interval", 1 , NULL, 't'},
|
||||||
{"version", 0, NULL, 'V'},
|
{"version", 0, NULL, 'V'},
|
||||||
|
{"migrateval", 1, NULL, 'e'},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -103,7 +105,7 @@ static void usage(void)
|
||||||
{
|
{
|
||||||
log(TO_CONSOLE, LOG_INFO, "irqbalance [--oneshot | -o] [--debug | -d] [--foreground | -f] [--journal | -j]\n");
|
log(TO_CONSOLE, LOG_INFO, "irqbalance [--oneshot | -o] [--debug | -d] [--foreground | -f] [--journal | -j]\n");
|
||||||
log(TO_CONSOLE, LOG_INFO, " [--powerthresh= | -p <off> | <n>] [--banirq= | -i <n>] [--banmod= | -m <module>] [--policyscript= | -l <script>]\n");
|
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>]\n");
|
log(TO_CONSOLE, LOG_INFO, " [--pid= | -s <file>] [--deepestcache= | -c <n>] [--interval= | -t <n>] [--migrateval= | -e <n>]\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void version(void)
|
static void version(void)
|
||||||
|
@ -118,7 +120,7 @@ static void parse_command_line(int argc, char **argv)
|
||||||
unsigned long val;
|
unsigned long val;
|
||||||
|
|
||||||
while ((opt = getopt_long(argc, argv,
|
while ((opt = getopt_long(argc, argv,
|
||||||
"odfji:p:s:c:l:m:t:V",
|
"odfjVi:p:s:c:l:m:t:e:",
|
||||||
lopts, &longind)) != -1) {
|
lopts, &longind)) != -1) {
|
||||||
|
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
|
@ -187,6 +189,9 @@ static void parse_command_line(int argc, char **argv)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'e':
|
||||||
|
migrate_ratio = strtoul(optarg, NULL, 10);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,7 @@ extern char *polscript;
|
||||||
extern cpumask_t banned_cpus;
|
extern cpumask_t banned_cpus;
|
||||||
extern cpumask_t unbanned_cpus;
|
extern cpumask_t unbanned_cpus;
|
||||||
extern long HZ;
|
extern long HZ;
|
||||||
|
extern unsigned long migrate_ratio;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Numa node access routines
|
* Numa node access routines
|
||||||
|
|
10
irqlist.c
10
irqlist.c
|
@ -76,6 +76,7 @@ static void compute_deviations(struct topo_obj *obj, void *data)
|
||||||
static void move_candidate_irqs(struct irq_info *info, void *data)
|
static void move_candidate_irqs(struct irq_info *info, void *data)
|
||||||
{
|
{
|
||||||
struct load_balance_info *lb_info = data;
|
struct load_balance_info *lb_info = data;
|
||||||
|
unsigned long delta_load = 0;
|
||||||
|
|
||||||
/* Don't rebalance irqs that don't want it */
|
/* Don't rebalance irqs that don't want it */
|
||||||
if (info->level == BALANCE_NONE)
|
if (info->level == BALANCE_NONE)
|
||||||
|
@ -91,10 +92,17 @@ static void move_candidate_irqs(struct irq_info *info, void *data)
|
||||||
if (info->load <= 1)
|
if (info->load <= 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (migrate_ratio > 0) {
|
||||||
|
delta_load = (lb_info->adjustment_load - lb_info->min_load) / migrate_ratio;
|
||||||
|
}
|
||||||
|
|
||||||
/* If we can migrate an irq without swapping the imbalance do it. */
|
/* If we can migrate an irq without swapping the imbalance do it. */
|
||||||
if ((lb_info->adjustment_load - info->load) > (lb_info->min_load + info->load)) {
|
if ((lb_info->min_load + info->load) - (lb_info->adjustment_load - info->load) < delta_load) {
|
||||||
lb_info->adjustment_load -= info->load;
|
lb_info->adjustment_load -= info->load;
|
||||||
lb_info->min_load += info->load;
|
lb_info->min_load += info->load;
|
||||||
|
if (lb_info->min_load > lb_info->adjustment_load) {
|
||||||
|
lb_info->min_load = lb_info->adjustment_load;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue