xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Dario Faggioli <dario.faggioli@citrix.com>
Cc: KeirFraser <keir@xen.org>, Ian Campbell <Ian.Campbell@citrix.com>,
	George Dunlap <george.dunlap@eu.citrix.com>,
	AndrewCooper <Andrew.Cooper3@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v6 3/9] xen: derive NUMA node affinity from hard and soft CPU affinity
Date: Wed, 28 May 2014 08:36:42 +0100	[thread overview]
Message-ID: <5385AE2A02000078000163AF@mail.emea.novell.com> (raw)
In-Reply-To: <1401237770-7003-4-git-send-email-dario.faggioli@citrix.com>

>>> On 28.05.14 at 02:42, <dario.faggioli@citrix.com> 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@suse.com>

  reply	other threads:[~2014-05-28  7:36 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-28  0:42 [PATCH v6 0/9] Implement vcpu soft affinity for credit1 Dario Faggioli
2014-05-28  0:42 ` [PATCH v6 1/9] xen: sched: rename v->cpu_affinity into v->cpu_hard_affinity Dario Faggioli
2014-05-28  7:28   ` Jan Beulich
2014-05-28  0:42 ` [PATCH v6 2/9] xen: sched: introduce soft-affinity and use it instead d->node-affinity Dario Faggioli
2014-05-28  7:33   ` Jan Beulich
2014-05-28 15:50     ` Dario Faggioli
2014-06-02 14:40   ` George Dunlap
2014-05-28  0:42 ` [PATCH v6 3/9] xen: derive NUMA node affinity from hard and soft CPU affinity Dario Faggioli
2014-05-28  7:36   ` Jan Beulich [this message]
2014-05-28  0:42 ` [PATCH v6 4/9] xen/libxc: sched: DOMCTL_*vcpuaffinity works with hard and soft affinity Dario Faggioli
2014-05-28  7:40   ` Jan Beulich
2014-05-28 15:09     ` Ian Campbell
2014-05-28  0:42 ` [PATCH v6 5/9] libxc: get and set soft and hard affinity Dario Faggioli
2014-05-28  0:42 ` [PATCH v6 6/9] libxl: get and set soft affinity Dario Faggioli
2014-05-28 15:13   ` Ian Campbell
2014-05-28 15:15     ` Dario Faggioli
2014-05-28 15:23   ` Ian Campbell
2014-06-05 12:59     ` Dario Faggioli
2014-06-06  8:46       ` Ian Campbell
2014-06-06 22:11         ` Dario Faggioli
2014-05-28  0:42 ` [PATCH v6 7/9] xl: enable getting and setting soft Dario Faggioli
2014-05-28 15:33   ` Ian Campbell
2014-05-28 16:01     ` Dario Faggioli
2014-06-02 15:20   ` George Dunlap
2014-05-28  0:42 ` [PATCH v6 8/9] xl: enable for specifying node-affinity in the config file Dario Faggioli
2014-05-28 15:48   ` Ian Campbell
2014-05-28 16:55     ` Dario Faggioli
2014-05-28  0:42 ` [PATCH v6 9/9] libxl: automatic NUMA placement affects soft affinity Dario Faggioli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5385AE2A02000078000163AF@mail.emea.novell.com \
    --to=jbeulich@suse.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=dario.faggioli@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).