|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v6 3/9] xen: derive NUMA node affinity from hard and soft CPU affinity
>>> On 28.05.14 at 02:42, <dario.faggioli@xxxxxxxxxx> wrote:
> @@ -425,31 +425,48 @@ void domain_update_node_affinity(struct domain *d)
>
> spin_lock(&d->node_affinity_lock);
>
> - for_each_vcpu ( d, v )
> - {
> - cpumask_and(online_affinity, v->cpu_hard_affinity, online);
> - cpumask_or(cpumask, cpumask, online_affinity);
> - }
> -
> /*
> - * If d->auto_node_affinity is true, the domain's node-affinity mask
> - * (d->node_affinity) is automaically computed from all the domain's
> - * vcpus' vcpu-affinity masks (the union of which we have just built
> - * above in cpumask). OTOH, if d->auto_node_affinity is false, we
> - * must leave the node-affinity of the domain alone.
> + * If d->auto_node_affinity is true, let's compute the domain's
> + * node-affinity and update d->node_affinity accordingly. if false,
> + * just leave d->auto_node_affinity alone.
> */
> if ( d->auto_node_affinity )
> {
> + /*
> + * We want the narrowest possible set of pcpus (to get the narowest
> + * possible set of nodes). What we need is the cpumask of where the
> + * domain can run (the union of the hard affinity of all its vcpus),
> + * and the full mask of where it would prefer to run (the union of
> + * the soft affinity of all its various vcpus). Let's build them.
> + */
> + for_each_vcpu ( d, v )
> + {
> + cpumask_or(dom_cpumask, dom_cpumask, v->cpu_hard_affinity);
> + cpumask_or(dom_cpumask_soft, dom_cpumask_soft,
> + v->cpu_soft_affinity);
> + }
> + /* Filter out non-online cpus */
> + cpumask_and(dom_cpumask, dom_cpumask, online);
> + ASSERT(!cpumask_empty(dom_cpumask));
> + /* And compute the intersection between hard, online and soft */
> + cpumask_and(dom_cpumask_soft, dom_cpumask_soft, dom_cpumask);
> +
> + /*
> + * If not empty, the intersection of hard, soft and online is the
> + * narrowest set we want. If empty, we fall back to hard&online.
> + */
> + dom_affinity = cpumask_empty(dom_cpumask_soft) ?
> + dom_cpumask : dom_cpumask_soft;
> +
> nodes_clear(d->node_affinity);
> - for_each_online_node ( node )
> - if ( cpumask_intersects(&node_to_cpumask(node), cpumask) )
> - node_set(node, d->node_affinity);
> + for_each_cpu( cpu, dom_affinity )
There's a minor coding style issue here (missing blank before opening
parenthesis), but nonetheless
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |