xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Dario Faggioli <dario.faggioli@citrix.com>
To: anshul makkar <anshul.makkar@citrix.com>, xen-devel@lists.xenproject.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Subject: Re: [PATCH 1/6] xen: credit1: simplify csched_runq_steal() a little bit.
Date: Fri, 3 Mar 2017 14:39:38 +0100	[thread overview]
Message-ID: <1488548378.5548.208.camel@citrix.com> (raw)
In-Reply-To: <2ce79bdd-7218-02e3-a015-3e4eb6d469b0@citrix.com>


[-- Attachment #1.1: Type: text/plain, Size: 3413 bytes --]

On Fri, 2017-03-03 at 09:35 +0000, anshul makkar wrote:
> On 02/03/17 10:38, Dario Faggioli wrote:
> > --- a/xen/common/sched_credit.c
> > +++ b/xen/common/sched_credit.c
> > @@ -1593,64 +1593,65 @@ static struct csched_vcpu *
> >   csched_runq_steal(int peer_cpu, int cpu, int pri, int
> > balance_step)
> >   {
> >       const struct csched_pcpu * const peer_pcpu =
> > CSCHED_PCPU(peer_cpu);
> > -    const struct vcpu * const peer_vcpu = curr_on_cpu(peer_cpu);
> >       struct csched_vcpu *speer;
> >       struct list_head *iter;
> >       struct vcpu *vc;
> >   
> > +    ASSERT(peer_pcpu != NULL);
> > +
> >       /*
> >        * Don't steal from an idle CPU's runq because it's about to
> >        * pick up work from it itself.
> >        */
> > -    if ( peer_pcpu != NULL && !is_idle_vcpu(peer_vcpu) )
> > +    if ( unlikely(is_idle_vcpu(curr_on_cpu(peer_cpu))) )
> > +        goto out;
> We can just use if (!is_idle_vcpu(peer_vcpu)). Why to replace it
> with 
> some code that introduces an unnecessary branch statement.
>
Mmm... I don't think I understand what this means.

> > +        /*
> > +         * If the vcpu has no useful soft affinity, skip this
> > vcpu.
> > +         * In fact, what we want is to check if we have any "soft-
> > affine
> > +         * work" to steal, before starting to look at "hard-affine 
> > work".
> > +         *
> > +         * Notice that, if not even one vCPU on this runq has a
> > useful
> > +         * soft affinity, we could have avoid considering this
> > runq for
> > +         * a soft balancing step in the first place. This, for
> > instance,
> > +         * can be implemented by taking note of on what runq there
> > are
> > +         * vCPUs with useful soft affinities in some sort of
> > bitmap
> > +         * or counter.
> > +         */
>
> Isn't it a better approach that now as we have came across a vcpu
> which 
> doesn't have a desired soft affinity but is a potential candidate
> for 
> migration, so instead of just forgetting it,  lets save the
> information 
> for such vcpus in some data structure in some order so that we don't 
> have to scan them again if we don't find anything useful in the
> present run.
>
So, AFAIUI, you're suggesting something like this:
 1. for each vcpu in the runqueue, we check soft-affinity. If it 
    matches, we're done;
 2. if it does not match, we check hard-affinity. If it matches, we 
    save that vcpu somewhere. We only need to save one vcpu, the first 
    one that we find to have matching hard-affinity;
 3. if we don't find any vcpu with matching soft affinity, we steal 
    the one we've saved.

Is this correct? If yes, if there's not anything I'm overlooking, I
think it could work.

It's a separate patch, of course. I can try putting that together,
unless of course you want to give this a go yourself. :-)

Thanks and Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 127 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-03-03 13:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02 10:37 [PATCH 0/6] xen: sched: improve scalability of Credit1, and optimize a bit both Credit1 and Credit2 Dario Faggioli
2017-03-02 10:38 ` [PATCH 1/6] xen: credit1: simplify csched_runq_steal() a little bit Dario Faggioli
2017-03-03  9:35   ` anshul makkar
2017-03-03 13:39     ` Dario Faggioli [this message]
2017-03-02 10:38 ` [PATCH 2/6] xen: credit: (micro) optimize csched_runq_steal() Dario Faggioli
2017-03-03  9:48   ` anshul makkar
2017-03-03 13:53     ` Dario Faggioli
2017-03-02 10:38 ` [PATCH 3/6] xen: credit1: increase efficiency and scalability of load balancing Dario Faggioli
2017-03-02 11:06   ` Andrew Cooper
2017-03-02 11:35     ` Dario Faggioli
2017-04-06  7:37     ` Dario Faggioli
2017-03-02 10:38 ` [PATCH 4/6] xen: credit1: treat pCPUs more evenly during balancing Dario Faggioli
2017-03-02 10:38 ` [PATCH 5/6] xen/tools: tracing: add record for credit1 runqueue stealing Dario Faggioli
2017-03-02 10:38 ` [PATCH 6/6] xen: credit2: avoid cpumask_any() in pick_cpu() Dario Faggioli
2017-03-02 10:58 ` [PATCH 0/6] xen: sched: improve scalability of Credit1, and optimize a bit both Credit1 and Credit2 Dario Faggioli
2017-03-27  9:08 ` 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=1488548378.5548.208.camel@citrix.com \
    --to=dario.faggioli@citrix.com \
    --cc=anshul.makkar@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --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).