From dcc411e7bfdd95bbdb7fd0af8699f8cafe686ff4 Mon Sep 17 00:00:00 2001 From: Neil Horman Date: Tue, 26 Apr 2016 14:55:55 -0400 Subject: [PATCH] remove affinity_hint infrastructure PJ is redesiging how affinity hinting works in the kernel, the future model will just tell us to ignore an irq, and the kernel will handle placement for us. As such we can remove the affinity_hint recognition entirely Signed-off-by: Neil Horman --- activate.c | 28 ++-------------------------- classify.c | 35 +++-------------------------------- irqbalance.1 | 19 ------------------- irqbalance.c | 15 +-------------- irqbalance.h | 7 ------- irqlist.c | 7 ------- placement.c | 14 -------------- procinterrupts.c | 2 -- 8 files changed, 6 insertions(+), 121 deletions(-) diff --git a/activate.c b/activate.c index c8453d5..8fd3dd0 100644 --- a/activate.c +++ b/activate.c @@ -69,33 +69,9 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un if (!info->moved) return; - if ((info->hint_policy == HINT_POLICY_EXACT) && - (!cpus_empty(info->affinity_hint))) { - if (cpus_intersects(info->affinity_hint, banned_cpus)) - log(TO_ALL, LOG_WARNING, - "irq %d affinity_hint and banned cpus confict\n", - info->irq); - else { - applied_mask = info->affinity_hint; - valid_mask = 1; - } - } else if (info->assigned_obj) { + if (info->assigned_obj) { applied_mask = info->assigned_obj->mask; - if ((info->hint_policy == HINT_POLICY_SUBSET) && - (!cpus_empty(info->affinity_hint))) { - cpus_and(applied_mask, applied_mask, info->affinity_hint); - if (!cpus_intersects(applied_mask, unbanned_cpus)) { - if (!info->warned) { - info->warned = 1; - log(TO_ALL, LOG_WARNING, - "irq %d affinity_hint subset empty\n", - info->irq); - } - } else - valid_mask = 1; - } else { - valid_mask = 1; - } + valid_mask = 1; } /* diff --git a/classify.c b/classify.c index 23cdedb..23fe274 100644 --- a/classify.c +++ b/classify.c @@ -31,7 +31,6 @@ struct user_irq_policy { int level; int numa_node_set; int numa_node; - enum hp_e hintpolicy; }; static GList *interrupts_db = NULL; @@ -283,7 +282,6 @@ static void add_banned_irq(int irq, GList **list) new->irq = irq; new->flags |= IRQ_FLAG_BANNED; - new->hint_policy = HINT_POLICY_EXACT; *list = g_list_append(*list, new); log(TO_CONSOLE, LOG_INFO, "IRQ %d was BANNED.\n", irq); @@ -347,7 +345,6 @@ void add_cl_banned_module(char *modname) static struct irq_info *add_one_irq_to_db(const char *devpath, int irq, struct user_irq_policy *pol) { int irq_class = IRQ_OTHER; - int rc; struct irq_info *new, find; int numa_node; char path[PATH_MAX]; @@ -378,7 +375,6 @@ static struct irq_info *add_one_irq_to_db(const char *devpath, int irq, struct u new->irq = irq; new->class = IRQ_OTHER; - new->hint_policy = pol->hintpolicy; interrupts_db = g_list_append(interrupts_db, new); @@ -402,7 +398,7 @@ get_numa_node: sprintf(path, "%s/numa_node", devpath); fd = fopen(path, "r"); if (fd) { - rc = fscanf(fd, "%d", &numa_node); + fscanf(fd, "%d", &numa_node); fclose(fd); } } @@ -416,7 +412,7 @@ get_numa_node: fd = fopen(path, "r"); if (!fd) { cpus_setall(new->cpumask); - goto assign_affinity_hint; + goto out; } lcpu_mask = NULL; ret = getline(&lcpu_mask, &blen, fd); @@ -428,19 +424,6 @@ get_numa_node: } free(lcpu_mask); -assign_affinity_hint: - cpus_clear(new->affinity_hint); - sprintf(path, "/proc/irq/%d/affinity_hint", irq); - fd = fopen(path, "r"); - if (!fd) - goto out; - lcpu_mask = NULL; - ret = getline(&lcpu_mask, &blen, fd); - fclose(fd); - if (ret <= 0) - goto out; - cpumask_parse_user(lcpu_mask, ret, new->affinity_hint); - free(lcpu_mask); out: log(TO_CONSOLE, LOG_INFO, "Adding IRQ %d to database\n", irq); return new; @@ -499,17 +482,6 @@ static void parse_user_policy_key(char *buf, int irq, struct user_irq_policy *po } pol->numa_node = idx; pol->numa_node_set = 1; - } else if (!strcasecmp("hintpolicy", key)) { - if (!strcasecmp("exact", value)) - pol->hintpolicy = HINT_POLICY_EXACT; - else if (!strcasecmp("subset", value)) - pol->hintpolicy = HINT_POLICY_SUBSET; - else if (!strcasecmp("ignore", value)) - pol->hintpolicy = HINT_POLICY_IGNORE; - else { - key_set = 0; - log(TO_ALL, LOG_WARNING, "Unknown value for hitpolicy: %s\n", value); - } } else { key_set = 0; log(TO_ALL, LOG_WARNING, "Unknown key returned, ignoring: %s\n", key); @@ -534,7 +506,6 @@ static void get_irq_user_policy(char *path, int irq, struct user_irq_policy *pol char *brc; memset(pol, -1, sizeof(struct user_irq_policy)); - pol->hintpolicy = global_hint_policy; /* Return defaults if no script was given */ if (!polscript) @@ -575,7 +546,7 @@ static int check_for_module_ban(char *name) return 0; } -static int check_for_irq_ban(char *path, int irq, GList *proc_interrupts) +static int check_for_irq_ban(char *path __attribute__((unused)), int irq, GList *proc_interrupts) { struct irq_info find, *res; GList *entry; diff --git a/irqbalance.1 b/irqbalance.1 index 67b19bc..559ba85 100644 --- a/irqbalance.1 +++ b/irqbalance.1 @@ -49,21 +49,6 @@ Causes irqbalance to run in the foreground (without --debug). .B -j, --journal Enables log output optimized for systemd-journal. -.TP -.B -h, --hintpolicy=[exact | subset | ignore] -Set the policy for how IRQ kernel affinity hinting is treated. Can be one of: -.P -.I exact -IRQ affinity hint is applied unilaterally and never violated. -.P -.I subset -IRQ is balanced, but the assigned object will be a subset of the affinity hint. -.P -.I ignore -IRQ affinity hint value is completely ignored. -.P -The default value for hintpolicy is ignore. - .TP .B -p, --powerthresh= Set the threshold at which we attempt to move a CPU into powersave mode @@ -122,10 +107,6 @@ that irqbalance can bias IRQ affinity for these devices toward its most local node. Note that specifying a -1 here forces irqbalance to consider an interrupt from a device to be equidistant from all nodes. .TP -.I hintpolicy=[exact | subset | ignore ] -This allows a user to override the globally set hintpolicy for a given irq. Use -is identical to the --hintpolicy setting, but applied per irq -.TP .B -s, --pid= Have irqbalance write its process id to the specified file. By default no pidfile is written. The written pidfile is automatically unlinked when diff --git a/irqbalance.c b/irqbalance.c index 2a230b2..2eeee24 100644 --- a/irqbalance.c +++ b/irqbalance.c @@ -50,7 +50,6 @@ int journal_logging = 0; int need_rescan; unsigned int log_mask = TO_ALL; const char *log_indent; -enum hp_e global_hint_policy = HINT_POLICY_IGNORE; unsigned long power_thresh = ULONG_MAX; unsigned long deepest_cache = 2; unsigned long long cycle_count = 0; @@ -106,7 +105,7 @@ static void parse_command_line(int argc, char **argv) unsigned long val; while ((opt = getopt_long(argc, argv, - "odfjh:i:p:s:c:b:l:m:t:", + "odfji:p:s:c:b:l:m:t:", lopts, &longind)) != -1) { switch(opt) { @@ -140,18 +139,6 @@ static void parse_command_line(int argc, char **argv) case 'f': foreground_mode=1; break; - case 'h': - if (!strncmp(optarg, "exact", strlen(optarg))) - global_hint_policy = HINT_POLICY_EXACT; - else if (!strncmp(optarg, "subset", strlen(optarg))) - global_hint_policy = HINT_POLICY_SUBSET; - else if (!strncmp(optarg, "ignore", strlen(optarg))) - global_hint_policy = HINT_POLICY_IGNORE; - else { - usage(); - exit(1); - } - break; case 'i': val = strtoull(optarg, NULL, 10); if (val == ULONG_MAX) { diff --git a/irqbalance.h b/irqbalance.h index eea3827..d2d0f07 100644 --- a/irqbalance.h +++ b/irqbalance.h @@ -63,17 +63,10 @@ extern GList *cache_domains; extern GList *cpus; extern int numa_avail; -enum hp_e { - HINT_POLICY_IGNORE, - HINT_POLICY_SUBSET, - HINT_POLICY_EXACT -}; - extern int debug_mode; extern int journal_logging; extern int one_shot_mode; extern int need_rescan; -extern enum hp_e global_hint_policy; extern unsigned long long cycle_count; extern unsigned long power_thresh; extern unsigned long deepest_cache; diff --git a/irqlist.c b/irqlist.c index 5037eca..f727e3d 100644 --- a/irqlist.c +++ b/irqlist.c @@ -77,13 +77,6 @@ static void move_candidate_irqs(struct irq_info *info, void *data) { struct load_balance_info *lb_info = data; - /* never move an irq that has an afinity hint when - * hint_policy is HINT_POLICY_EXACT - */ - if (info->hint_policy == HINT_POLICY_EXACT) - if (!cpus_empty(info->affinity_hint)) - return; - /* Don't rebalance irqs that don't want it */ if (info->level == BALANCE_NONE) return; diff --git a/placement.c b/placement.c index f476e02..5a82111 100644 --- a/placement.c +++ b/placement.c @@ -41,7 +41,6 @@ static void find_best_object(struct topo_obj *d, void *data) { struct obj_placement *best = (struct obj_placement *)data; uint64_t newload; - cpumask_t subset; /* * Don't consider the unspecified numa node here @@ -57,19 +56,6 @@ static void find_best_object(struct topo_obj *d, void *data) (!cpus_intersects(d->mask, unbanned_cpus))) return; - /* - * If the hint policy is subset, then we only want - * to consider objects that are within the irqs hint, but - * only if that irq in fact has published a hint - */ - if (best->info->hint_policy == HINT_POLICY_SUBSET) { - if (!cpus_empty(best->info->affinity_hint)) { - cpus_and(subset, best->info->affinity_hint, d->mask); - if (cpus_empty(subset)) - return; - } - } - if (d->powersave_mode) return; diff --git a/procinterrupts.c b/procinterrupts.c index b70bfc2..6b37a88 100644 --- a/procinterrupts.c +++ b/procinterrupts.c @@ -148,7 +148,6 @@ GList* collect_full_irq_list() char *line = NULL; size_t size = 0; char *irq_name, *irq_mod, *savedptr, *last_token, *p; - char *tmp; file = fopen("/proc/interrupts", "r"); if (!file) @@ -217,7 +216,6 @@ GList* collect_full_irq_list() info->class = IRQ_OTHER; #endif } - info->hint_policy = global_hint_policy; info->name = strdupa(irq_mod); tmp_list = g_list_append(tmp_list, info); }