Make irqbalance scan for new irqs when it detects new irqs

Like cpu hotplug, irqbalance needs to rebuild its topo map and irq db when it
detects new irqs in the system.  This patch adds that ability

Resolves: http://code.google.com/p/irqbalance/issues/detail?id=32

Singed-off-by: Neil Horman <nhorman@tuxdriver.com>
This commit is contained in:
Neil Horman 2012-07-02 13:27:14 -04:00
parent b632577f90
commit 1523a7830c
3 changed files with 16 additions and 6 deletions

View file

@ -46,7 +46,7 @@ int one_shot_mode;
int debug_mode;
int foreground_mode;
int numa_avail;
int need_cpu_rescan;
int need_rescan;
extern cpumask_t banned_cpus;
enum hp_e hint_policy = HINT_POLICY_SUBSET;
unsigned long power_thresh = ULONG_MAX;
@ -301,8 +301,8 @@ int main(int argc, char** argv)
parse_proc_stat();
/* cope with cpu hotplug -- detected during /proc/interrupts parsing */
if (need_cpu_rescan) {
need_cpu_rescan = 0;
if (need_rescan) {
need_rescan = 0;
/* if there's a hotplug event we better turn off power mode for a bit until things settle */
power_mode = 0;
if (debug_mode)

View file

@ -64,7 +64,7 @@ enum hp_e {
extern int debug_mode;
extern int one_shot_mode;
extern int power_mode;
extern int need_cpu_rescan;
extern int need_rescan;
extern enum hp_e hint_policy;
extern unsigned long long cycle_count;
extern unsigned long power_thresh;

View file

@ -83,8 +83,18 @@ void parse_proc_interrupts(void)
c++;
number = strtoul(line, NULL, 10);
info = get_irq_info(number);
if (!info)
if (!info) {
/*
* If this is our 0th pass through this routine
* this is an irq that wasn't reported in sysfs
* and we should just add it. If we've been running
* a while then this irq just appeared and its time
* to rescan our irqs
*/
if (cycle_count)
need_rescan = 1;
info = add_misc_irq(number);
}
count = 0;
cpunr = 0;
@ -100,7 +110,7 @@ void parse_proc_interrupts(void)
cpunr++;
}
if (cpunr != core_count)
need_cpu_rescan = 1;
need_rescan = 1;
info->last_irq_count = info->irq_count;
info->irq_count = count;