Fix a segfault with powersave mode
If we detect a powersave condition we may accidentally pass a NULL list to migrate_irq (if the object going into powersave has no irqs on it). Fix that to prevent the crash. Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
This commit is contained in:
parent
fa7e2ea4db
commit
c34312bded
|
@ -281,7 +281,7 @@ static void dump_cache_domain(struct topo_obj *d, void *data)
|
|||
printf(" Cache domain %i: numa_node is %d cpu mask is %s (load %lu) \n", d->number, cache_domain_numa_node(d)->number, buffer, (unsigned long)d->load);
|
||||
if (d->children)
|
||||
for_each_object(d->children, dump_topo_obj, NULL);
|
||||
if (d->interrupts)
|
||||
if (g_list_length(d->interrupts) > 0)
|
||||
for_each_irq(d->interrupts, dump_irq, (void *)10);
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ static void dump_package(struct topo_obj *d, void *data)
|
|||
printf("Package %i: numa_node is %d cpu mask is %s (load %lu)\n", d->number, package_numa_node(d)->number, buffer, (unsigned long)d->load);
|
||||
if (d->children)
|
||||
for_each_object(d->children, dump_cache_domain, buffer);
|
||||
if (d->interrupts)
|
||||
if (g_list_length(d->interrupts) > 0)
|
||||
for_each_irq(d->interrupts, dump_irq, (void *)2);
|
||||
}
|
||||
|
||||
|
|
|
@ -112,6 +112,8 @@ static void migrate_overloaded_irqs(struct topo_obj *obj, void *data)
|
|||
if (obj->load <= info->avg_load) {
|
||||
if ((obj->load + info->std_deviation) <= info->avg_load) {
|
||||
info->num_under++;
|
||||
if (!info->powersave)
|
||||
if (!obj->powersave_mode)
|
||||
info->powersave = obj;
|
||||
} else
|
||||
info->num_within++;
|
||||
|
@ -169,12 +171,12 @@ static void clear_powersave_mode(struct topo_obj *obj, void *data __attribute__(
|
|||
void update_migration_status(void)
|
||||
{
|
||||
struct load_balance_info info;
|
||||
|
||||
find_overloaded_objs(cpus, info);
|
||||
if (cycle_count > 5) {
|
||||
if (!info.num_over && (info.num_under >= power_thresh)) {
|
||||
if (!info.num_over && (info.num_under >= power_thresh) && info.powersave) {
|
||||
syslog(LOG_INFO, "cpu %d entering powersave mode\n", info.powersave->number);
|
||||
info.powersave->powersave_mode = 1;
|
||||
if (g_list_length(info.powersave->interrupts) > 0)
|
||||
for_each_irq(info.powersave->interrupts, force_irq_migration, NULL);
|
||||
} else if (info.num_over) {
|
||||
syslog(LOG_INFO, "Load average increasing, re-enabling all cpus for irq balancing\n");
|
||||
|
|
|
@ -171,7 +171,7 @@ static void validate_irq(struct irq_info *info, void *data)
|
|||
|
||||
static void validate_object(struct topo_obj *d, void *data __attribute__((unused)))
|
||||
{
|
||||
if (d->interrupts)
|
||||
if (g_list_length(d->interrupts) > 0)
|
||||
for_each_irq(d->interrupts, validate_irq, d);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue