Add hot pull method for irqbalance

This commit is contained in:
hejingxian 00273181 2021-01-04 12:34:02 +08:00
parent 6ae114f871
commit ef9bf64aff
4 changed files with 42 additions and 1 deletions

View File

@ -852,3 +852,40 @@ void sort_irq_list(GList **list)
{
*list = g_list_sort(*list, sort_irqs);
}
static void remove_no_existing_irq(struct irq_info *info, void *data __attribute__((unused)))
{
GList *entry = NULL;
if (info->existing) {
/* clear existing flag for next detection */
info->existing = 0;
return;
}
entry = g_list_find_custom(interrupts_db, info, compare_ints);
if (entry)
interrupts_db = g_list_delete_link(interrupts_db, entry);
entry = g_list_find_custom(rebalance_irq_list, info, compare_ints);
if (entry)
rebalance_irq_list = g_list_delete_link(rebalance_irq_list, entry);
if(info->assigned_obj) {
entry = g_list_find_custom(info->assigned_obj->interrupts, info, compare_ints);
if (entry) {
info->assigned_obj->interrupts = g_list_delete_link(info->assigned_obj->interrupts, entry);
}
}
log(TO_CONSOLE, LOG_INFO, "IRQ %d is removed from interrupts_db.\n", info->irq);
free_irq(info, NULL);
}
void clear_no_existing_irqs(void)
{
for_each_irq(NULL, remove_no_existing_irq, NULL);
if (banned_irqs) {
for_each_irq(banned_irqs, remove_no_existing_irq, NULL);
}
}

View File

@ -42,6 +42,7 @@ extern void set_interrupt_count(int number, uint64_t count);
extern void set_msi_interrupt_numa(int number);
extern void init_irq_class_and_type(char *savedline, struct irq_info *info, int irq);
extern int proc_irq_hotplug(char *line, int irq, struct irq_info **pinfo);
extern void clear_no_existing_irqs(void);
extern GList *rebalance_irq_list;
extern void force_rebalance_irq(struct irq_info *info, void *data __attribute__((unused)));

View File

@ -248,7 +248,6 @@ GList* collect_full_irq_list()
return tmp_list;
}
void parse_proc_interrupts(void)
{
FILE *file;
@ -310,6 +309,7 @@ void parse_proc_interrupts(void)
break;
}
}
info->existing = 1;
free(savedline);
count = 0;
@ -354,6 +354,8 @@ void parse_proc_interrupts(void)
*/
msi_found_in_sysfs = 1;
}
if (!need_rescan)
clear_no_existing_irqs();
fclose(file);
free(line);
}

View File

@ -70,6 +70,7 @@ struct irq_info {
uint64_t last_irq_count;
uint64_t load;
int moved;
int existing;
struct topo_obj *assigned_obj;
char *name;
};