Permalink
Browse files

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 <nhorman@tuxdriver.com>
  • Loading branch information...
Neil Horman
Neil Horman committed Apr 26, 2016
1 parent 9eafcd1 commit dcc411e7bfdd95bbdb7fd0af8699f8cafe686ff4
Showing with 6 additions and 121 deletions.
  1. +2 −26 activate.c
  2. +3 −32 classify.c
  3. +0 −19 irqbalance.1
  4. +1 −14 irqbalance.c
  5. +0 −7 irqbalance.h
  6. +0 −7 irqlist.c
  7. +0 −14 placement.c
  8. +0 −2 procinterrupts.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;
}
/*
@@ -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 @@ static struct irq_info *add_one_irq_to_db(const char *devpath, int irq, struct u
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 @@ static struct irq_info *add_one_irq_to_db(const char *devpath, int irq, struct u
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 @@ static struct irq_info *add_one_irq_to_db(const char *devpath, int irq, struct u
}
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;
@@ -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=<threshold>
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=<file>
Have irqbalance write its process id to the specified file. By default no
pidfile is written. The written pidfile is automatically unlinked when
@@ -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) {
@@ -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;
@@ -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;
@@ -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;
@@ -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);
}

0 comments on commit dcc411e

Please sign in to comment.