Merge pull request #9 from sbohrer/master
Initialization bugfix and marking functions static where appropriate
This commit is contained in:
commit
6190d1b074
75
classify.c
75
classify.c
|
@ -22,7 +22,7 @@ char *classes[] = {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
int map_class_to_level[8] =
|
static int map_class_to_level[8] =
|
||||||
{ BALANCE_PACKAGE, BALANCE_CACHE, BALANCE_CORE, BALANCE_CORE, BALANCE_CORE, BALANCE_CORE, BALANCE_CORE, BALANCE_CORE };
|
{ BALANCE_PACKAGE, BALANCE_CACHE, BALANCE_CORE, BALANCE_CORE, BALANCE_CORE, BALANCE_CORE, BALANCE_CORE, BALANCE_CORE };
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ static gint compare_ints(gconstpointer a, gconstpointer b)
|
||||||
return ai->irq - bi->irq;
|
return ai->irq - bi->irq;
|
||||||
}
|
}
|
||||||
|
|
||||||
void add_banned_irq(int irq, GList **list)
|
static void add_banned_irq(int irq, GList **list)
|
||||||
{
|
{
|
||||||
struct irq_info find, *new;
|
struct irq_info find, *new;
|
||||||
GList *entry;
|
GList *entry;
|
||||||
|
@ -325,13 +325,13 @@ static void get_irq_user_policy(char *path, int irq, struct user_irq_policy *pol
|
||||||
char buffer[128];
|
char buffer[128];
|
||||||
char *brc;
|
char *brc;
|
||||||
|
|
||||||
|
memset(pol, -1, sizeof(struct user_irq_policy));
|
||||||
|
pol->hintpolicy = global_hint_policy;
|
||||||
|
|
||||||
/* Return defaults if no script was given */
|
/* Return defaults if no script was given */
|
||||||
if (!polscript)
|
if (!polscript)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memset(pol, -1, sizeof(struct user_irq_policy));
|
|
||||||
pol->hintpolicy = global_hint_policy;
|
|
||||||
|
|
||||||
cmd = alloca(strlen(path)+strlen(polscript)+64);
|
cmd = alloca(strlen(path)+strlen(polscript)+64);
|
||||||
if (!cmd)
|
if (!cmd)
|
||||||
return;
|
return;
|
||||||
|
@ -487,6 +487,38 @@ void free_irq_db(void)
|
||||||
rebalance_irq_list = NULL;
|
rebalance_irq_list = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void add_new_irq(int irq, struct irq_info *hint)
|
||||||
|
{
|
||||||
|
struct irq_info *new;
|
||||||
|
struct user_irq_policy pol;
|
||||||
|
|
||||||
|
new = get_irq_info(irq);
|
||||||
|
if (new)
|
||||||
|
return;
|
||||||
|
|
||||||
|
get_irq_user_policy("/sys", irq, &pol);
|
||||||
|
if ((pol.ban == 1) || check_for_irq_ban(NULL, irq)) {
|
||||||
|
add_banned_irq(irq, &banned_irqs);
|
||||||
|
new = get_irq_info(irq);
|
||||||
|
} else
|
||||||
|
new = add_one_irq_to_db("/sys", irq, &pol);
|
||||||
|
|
||||||
|
if (!new) {
|
||||||
|
log(TO_CONSOLE, LOG_WARNING, "add_new_irq: Failed to add irq %d\n", irq);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Override some of the new irq defaults here
|
||||||
|
*/
|
||||||
|
if (hint) {
|
||||||
|
new->type = hint->type;
|
||||||
|
new->class = hint->class;
|
||||||
|
}
|
||||||
|
|
||||||
|
new->level = map_class_to_level[new->class];
|
||||||
|
}
|
||||||
|
|
||||||
static void add_missing_irq(struct irq_info *info, void *unused __attribute__((unused)))
|
static void add_missing_irq(struct irq_info *info, void *unused __attribute__((unused)))
|
||||||
{
|
{
|
||||||
struct irq_info *lookup = get_irq_info(info->irq);
|
struct irq_info *lookup = get_irq_info(info->irq);
|
||||||
|
@ -531,39 +563,6 @@ free:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct irq_info *add_new_irq(int irq, struct irq_info *hint)
|
|
||||||
{
|
|
||||||
struct irq_info *new;
|
|
||||||
struct user_irq_policy pol;
|
|
||||||
|
|
||||||
new = get_irq_info(irq);
|
|
||||||
if (new)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
get_irq_user_policy("/sys", irq, &pol);
|
|
||||||
if ((pol.ban == 1) || check_for_irq_ban(NULL, irq)) {
|
|
||||||
add_banned_irq(irq, &banned_irqs);
|
|
||||||
new = get_irq_info(irq);
|
|
||||||
} else
|
|
||||||
new = add_one_irq_to_db("/sys", irq, &pol);
|
|
||||||
|
|
||||||
if (!new) {
|
|
||||||
log(TO_CONSOLE, LOG_WARNING, "add_new_irq: Failed to add irq %d\n", irq);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Override some of the new irq defaults here
|
|
||||||
*/
|
|
||||||
if (hint) {
|
|
||||||
new->type = hint->type;
|
|
||||||
new->class = hint->class;
|
|
||||||
}
|
|
||||||
|
|
||||||
new->level = map_class_to_level[new->class];
|
|
||||||
return new;
|
|
||||||
}
|
|
||||||
|
|
||||||
void for_each_irq(GList *list, void (*cb)(struct irq_info *info, void *data), void *data)
|
void for_each_irq(GList *list, void (*cb)(struct irq_info *info, void *data), void *data)
|
||||||
{
|
{
|
||||||
GList *entry = g_list_first(list ? list : interrupts_db);
|
GList *entry = g_list_first(list ? list : interrupts_db);
|
||||||
|
|
|
@ -57,7 +57,7 @@ char *banscript = NULL;
|
||||||
char *polscript = NULL;
|
char *polscript = NULL;
|
||||||
long HZ;
|
long HZ;
|
||||||
|
|
||||||
void sleep_approx(int seconds)
|
static void sleep_approx(int seconds)
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
@ -209,7 +209,7 @@ static void dump_object_tree(void)
|
||||||
for_each_object(numa_nodes, dump_numa_node_info, NULL);
|
for_each_object(numa_nodes, dump_numa_node_info, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void force_rebalance_irq(struct irq_info *info, void *data __attribute__((unused)))
|
static void force_rebalance_irq(struct irq_info *info, void *data __attribute__((unused)))
|
||||||
{
|
{
|
||||||
if (info->level == BALANCE_NONE)
|
if (info->level == BALANCE_NONE)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -110,8 +110,6 @@ extern void add_cl_banned_irq(int irq);
|
||||||
extern void for_each_irq(GList *list, void (*cb)(struct irq_info *info, void *data), void *data);
|
extern void for_each_irq(GList *list, void (*cb)(struct irq_info *info, void *data), void *data);
|
||||||
extern struct irq_info *get_irq_info(int irq);
|
extern struct irq_info *get_irq_info(int irq);
|
||||||
extern void migrate_irq(GList **from, GList **to, struct irq_info *info);
|
extern void migrate_irq(GList **from, GList **to, struct irq_info *info);
|
||||||
extern struct irq_info *add_new_irq(int irq, struct irq_info *hint);
|
|
||||||
extern void force_rebalance_irq(struct irq_info *info, void *data);
|
|
||||||
#define irq_numa_node(irq) ((irq)->numa_node)
|
#define irq_numa_node(irq) ((irq)->numa_node)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue