check for conflicts between banned_cpus and affinity_hint

Currently affinity_hint ignores banned_cpus, so lets check and make sure that
out hint_policy, banned_cpu lists and affinity_hint don't result in invalid
assignments

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
This commit is contained in:
Neil Horman 2013-01-29 11:44:42 -05:00
parent edb06fcbb9
commit b1d8948271
3 changed files with 33 additions and 14 deletions

View file

@ -63,22 +63,40 @@ static void activate_mapping(struct irq_info *info, void *data __attribute__((un
cpumask_t applied_mask;
int valid_mask = 0;
if ((hint_policy == HINT_POLICY_EXACT) &&
(!cpus_empty(info->affinity_hint))) {
applied_mask = info->affinity_hint;
valid_mask = 1;
} else if (info->assigned_obj) {
applied_mask = info->assigned_obj->mask;
valid_mask = 1;
if ((hint_policy == HINT_POLICY_SUBSET) &&
(!cpus_empty(info->affinity_hint)))
cpus_and(applied_mask, applied_mask, info->affinity_hint);
}
/*
* only activate mappings for irqs that have moved
*/
if (!info->moved && (!valid_mask || check_affinity(info, applied_mask)))
if (!info->moved)
return;
if ((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) {
applied_mask = info->assigned_obj->mask;
if ((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))
log(TO_ALL, LOG_WARNING,
"irq %d affinity_hint subset empty\n",
info->irq);
else
valid_mask = 1;
}
}
/*
* Don't activate anything for which we have an invalid mask
*/
if (!valid_mask || check_affinity(info, applied_mask))
return;
if (!info->assigned_obj)

View file

@ -55,7 +55,7 @@ cpumask_t cpu_possible_map;
it's convenient to have the complement of banned_cpus available so that
the AND operator can be used to mask out unwanted cpus
*/
static cpumask_t unbanned_cpus;
cpumask_t unbanned_cpus;
static struct topo_obj* add_cache_domain_to_package(struct topo_obj *cache,
cpumask_t package_mask)

View file

@ -71,6 +71,7 @@ extern unsigned long power_thresh;
extern char *banscript;
extern char *polscript;
extern cpumask_t banned_cpus;
extern cpumask_t unbanned_cpus;
/*
* Numa node access routines