Skip to content

Commit dcc411e

Browse files
committed
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 <[email protected]>
1 parent 9eafcd1 commit dcc411e

File tree

8 files changed

+6
-121
lines changed

8 files changed

+6
-121
lines changed

activate.c

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -69,33 +69,9 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
6969
if (!info->moved)
7070
return;
7171

72-
if ((info->hint_policy == HINT_POLICY_EXACT) &&
73-
(!cpus_empty(info->affinity_hint))) {
74-
if (cpus_intersects(info->affinity_hint, banned_cpus))
75-
log(TO_ALL, LOG_WARNING,
76-
"irq %d affinity_hint and banned cpus confict\n",
77-
info->irq);
78-
else {
79-
applied_mask = info->affinity_hint;
80-
valid_mask = 1;
81-
}
82-
} else if (info->assigned_obj) {
72+
if (info->assigned_obj) {
8373
applied_mask = info->assigned_obj->mask;
84-
if ((info->hint_policy == HINT_POLICY_SUBSET) &&
85-
(!cpus_empty(info->affinity_hint))) {
86-
cpus_and(applied_mask, applied_mask, info->affinity_hint);
87-
if (!cpus_intersects(applied_mask, unbanned_cpus)) {
88-
if (!info->warned) {
89-
info->warned = 1;
90-
log(TO_ALL, LOG_WARNING,
91-
"irq %d affinity_hint subset empty\n",
92-
info->irq);
93-
}
94-
} else
95-
valid_mask = 1;
96-
} else {
97-
valid_mask = 1;
98-
}
74+
valid_mask = 1;
9975
}
10076

10177
/*

classify.c

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ struct user_irq_policy {
3131
int level;
3232
int numa_node_set;
3333
int numa_node;
34-
enum hp_e hintpolicy;
3534
};
3635

3736
static GList *interrupts_db = NULL;
@@ -283,7 +282,6 @@ static void add_banned_irq(int irq, GList **list)
283282

284283
new->irq = irq;
285284
new->flags |= IRQ_FLAG_BANNED;
286-
new->hint_policy = HINT_POLICY_EXACT;
287285

288286
*list = g_list_append(*list, new);
289287
log(TO_CONSOLE, LOG_INFO, "IRQ %d was BANNED.\n", irq);
@@ -347,7 +345,6 @@ void add_cl_banned_module(char *modname)
347345
static struct irq_info *add_one_irq_to_db(const char *devpath, int irq, struct user_irq_policy *pol)
348346
{
349347
int irq_class = IRQ_OTHER;
350-
int rc;
351348
struct irq_info *new, find;
352349
int numa_node;
353350
char path[PATH_MAX];
@@ -378,7 +375,6 @@ static struct irq_info *add_one_irq_to_db(const char *devpath, int irq, struct u
378375

379376
new->irq = irq;
380377
new->class = IRQ_OTHER;
381-
new->hint_policy = pol->hintpolicy;
382378

383379
interrupts_db = g_list_append(interrupts_db, new);
384380

@@ -402,7 +398,7 @@ static struct irq_info *add_one_irq_to_db(const char *devpath, int irq, struct u
402398
sprintf(path, "%s/numa_node", devpath);
403399
fd = fopen(path, "r");
404400
if (fd) {
405-
rc = fscanf(fd, "%d", &numa_node);
401+
fscanf(fd, "%d", &numa_node);
406402
fclose(fd);
407403
}
408404
}
@@ -416,7 +412,7 @@ static struct irq_info *add_one_irq_to_db(const char *devpath, int irq, struct u
416412
fd = fopen(path, "r");
417413
if (!fd) {
418414
cpus_setall(new->cpumask);
419-
goto assign_affinity_hint;
415+
goto out;
420416
}
421417
lcpu_mask = NULL;
422418
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
428424
}
429425
free(lcpu_mask);
430426

431-
assign_affinity_hint:
432-
cpus_clear(new->affinity_hint);
433-
sprintf(path, "/proc/irq/%d/affinity_hint", irq);
434-
fd = fopen(path, "r");
435-
if (!fd)
436-
goto out;
437-
lcpu_mask = NULL;
438-
ret = getline(&lcpu_mask, &blen, fd);
439-
fclose(fd);
440-
if (ret <= 0)
441-
goto out;
442-
cpumask_parse_user(lcpu_mask, ret, new->affinity_hint);
443-
free(lcpu_mask);
444427
out:
445428
log(TO_CONSOLE, LOG_INFO, "Adding IRQ %d to database\n", irq);
446429
return new;
@@ -499,17 +482,6 @@ static void parse_user_policy_key(char *buf, int irq, struct user_irq_policy *po
499482
}
500483
pol->numa_node = idx;
501484
pol->numa_node_set = 1;
502-
} else if (!strcasecmp("hintpolicy", key)) {
503-
if (!strcasecmp("exact", value))
504-
pol->hintpolicy = HINT_POLICY_EXACT;
505-
else if (!strcasecmp("subset", value))
506-
pol->hintpolicy = HINT_POLICY_SUBSET;
507-
else if (!strcasecmp("ignore", value))
508-
pol->hintpolicy = HINT_POLICY_IGNORE;
509-
else {
510-
key_set = 0;
511-
log(TO_ALL, LOG_WARNING, "Unknown value for hitpolicy: %s\n", value);
512-
}
513485
} else {
514486
key_set = 0;
515487
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
534506
char *brc;
535507

536508
memset(pol, -1, sizeof(struct user_irq_policy));
537-
pol->hintpolicy = global_hint_policy;
538509

539510
/* Return defaults if no script was given */
540511
if (!polscript)
@@ -575,7 +546,7 @@ static int check_for_module_ban(char *name)
575546
return 0;
576547
}
577548

578-
static int check_for_irq_ban(char *path, int irq, GList *proc_interrupts)
549+
static int check_for_irq_ban(char *path __attribute__((unused)), int irq, GList *proc_interrupts)
579550
{
580551
struct irq_info find, *res;
581552
GList *entry;

irqbalance.1

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,6 @@ Causes irqbalance to run in the foreground (without --debug).
4949
.B -j, --journal
5050
Enables log output optimized for systemd-journal.
5151

52-
.TP
53-
.B -h, --hintpolicy=[exact | subset | ignore]
54-
Set the policy for how IRQ kernel affinity hinting is treated. Can be one of:
55-
.P
56-
.I exact
57-
IRQ affinity hint is applied unilaterally and never violated.
58-
.P
59-
.I subset
60-
IRQ is balanced, but the assigned object will be a subset of the affinity hint.
61-
.P
62-
.I ignore
63-
IRQ affinity hint value is completely ignored.
64-
.P
65-
The default value for hintpolicy is ignore.
66-
6752
.TP
6853
.B -p, --powerthresh=<threshold>
6954
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
122107
node. Note that specifying a -1 here forces irqbalance to consider an interrupt
123108
from a device to be equidistant from all nodes.
124109
.TP
125-
.I hintpolicy=[exact | subset | ignore ]
126-
This allows a user to override the globally set hintpolicy for a given irq. Use
127-
is identical to the --hintpolicy setting, but applied per irq
128-
.TP
129110
.B -s, --pid=<file>
130111
Have irqbalance write its process id to the specified file. By default no
131112
pidfile is written. The written pidfile is automatically unlinked when

irqbalance.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ int journal_logging = 0;
5050
int need_rescan;
5151
unsigned int log_mask = TO_ALL;
5252
const char *log_indent;
53-
enum hp_e global_hint_policy = HINT_POLICY_IGNORE;
5453
unsigned long power_thresh = ULONG_MAX;
5554
unsigned long deepest_cache = 2;
5655
unsigned long long cycle_count = 0;
@@ -106,7 +105,7 @@ static void parse_command_line(int argc, char **argv)
106105
unsigned long val;
107106

108107
while ((opt = getopt_long(argc, argv,
109-
"odfjh:i:p:s:c:b:l:m:t:",
108+
"odfji:p:s:c:b:l:m:t:",
110109
lopts, &longind)) != -1) {
111110

112111
switch(opt) {
@@ -140,18 +139,6 @@ static void parse_command_line(int argc, char **argv)
140139
case 'f':
141140
foreground_mode=1;
142141
break;
143-
case 'h':
144-
if (!strncmp(optarg, "exact", strlen(optarg)))
145-
global_hint_policy = HINT_POLICY_EXACT;
146-
else if (!strncmp(optarg, "subset", strlen(optarg)))
147-
global_hint_policy = HINT_POLICY_SUBSET;
148-
else if (!strncmp(optarg, "ignore", strlen(optarg)))
149-
global_hint_policy = HINT_POLICY_IGNORE;
150-
else {
151-
usage();
152-
exit(1);
153-
}
154-
break;
155142
case 'i':
156143
val = strtoull(optarg, NULL, 10);
157144
if (val == ULONG_MAX) {

irqbalance.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,10 @@ extern GList *cache_domains;
6363
extern GList *cpus;
6464
extern int numa_avail;
6565

66-
enum hp_e {
67-
HINT_POLICY_IGNORE,
68-
HINT_POLICY_SUBSET,
69-
HINT_POLICY_EXACT
70-
};
71-
7266
extern int debug_mode;
7367
extern int journal_logging;
7468
extern int one_shot_mode;
7569
extern int need_rescan;
76-
extern enum hp_e global_hint_policy;
7770
extern unsigned long long cycle_count;
7871
extern unsigned long power_thresh;
7972
extern unsigned long deepest_cache;

irqlist.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,6 @@ static void move_candidate_irqs(struct irq_info *info, void *data)
7777
{
7878
struct load_balance_info *lb_info = data;
7979

80-
/* never move an irq that has an afinity hint when
81-
* hint_policy is HINT_POLICY_EXACT
82-
*/
83-
if (info->hint_policy == HINT_POLICY_EXACT)
84-
if (!cpus_empty(info->affinity_hint))
85-
return;
86-
8780
/* Don't rebalance irqs that don't want it */
8881
if (info->level == BALANCE_NONE)
8982
return;

placement.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ static void find_best_object(struct topo_obj *d, void *data)
4141
{
4242
struct obj_placement *best = (struct obj_placement *)data;
4343
uint64_t newload;
44-
cpumask_t subset;
4544

4645
/*
4746
* Don't consider the unspecified numa node here
@@ -57,19 +56,6 @@ static void find_best_object(struct topo_obj *d, void *data)
5756
(!cpus_intersects(d->mask, unbanned_cpus)))
5857
return;
5958

60-
/*
61-
* If the hint policy is subset, then we only want
62-
* to consider objects that are within the irqs hint, but
63-
* only if that irq in fact has published a hint
64-
*/
65-
if (best->info->hint_policy == HINT_POLICY_SUBSET) {
66-
if (!cpus_empty(best->info->affinity_hint)) {
67-
cpus_and(subset, best->info->affinity_hint, d->mask);
68-
if (cpus_empty(subset))
69-
return;
70-
}
71-
}
72-
7359
if (d->powersave_mode)
7460
return;
7561

procinterrupts.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ GList* collect_full_irq_list()
148148
char *line = NULL;
149149
size_t size = 0;
150150
char *irq_name, *irq_mod, *savedptr, *last_token, *p;
151-
char *tmp;
152151

153152
file = fopen("/proc/interrupts", "r");
154153
if (!file)
@@ -217,7 +216,6 @@ GList* collect_full_irq_list()
217216
info->class = IRQ_OTHER;
218217
#endif
219218
}
220-
info->hint_policy = global_hint_policy;
221219
info->name = strdupa(irq_mod);
222220
tmp_list = g_list_append(tmp_list, info);
223221
}

0 commit comments

Comments
 (0)