All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@eu.citrix.com>
To: Keir Fraser <keir@xen.org>
Cc: Dario Faggioli <dario.faggioli@citrix.com>,
	Jan Beulich <JBeulich@suse.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH] xen: Always ask the scheduler to re-place the vcpu when the affinity changes
Date: Mon, 4 Mar 2013 14:22:16 +0000	[thread overview]
Message-ID: <5134AE18.3050508@eu.citrix.com> (raw)
In-Reply-To: <CD5A5EF3.5D413%keir@xen.org>

On 04/03/13 14:23, Keir Fraser wrote:
> On 04/03/2013 14:03, "George Dunlap" <George.Dunlap@eu.citrix.com> wrote:
>
>>> But that's probably a rare enough occurrence that it's better overall
>>> to take the occasional double-migrate.
>> Hmm -- but thinking it further, it actually seems likely that a
>> different double-migrate race will happen:
>>
>> 1. vcpu is running on pcpu A
>> 2. pcpu B runs set_affinity, setting VPF_migrate
>> 3. pcpu B calls vcpu_sleep_nosync
>> 4. pcpu A wakes up and grabs the schedule lock
>> 5. pcpu A notices that VPF_migrate is set, and calls vcpu_migrate()
>> 6. pcpu B calls vcpu_migrate()
>>
>> Either that, or 6 happens before 4, but 4 still happens before pcpu B
>> clears VPF_migrate.
>>
>> It seems like we should really only call if (!v->is_running ||
>> v->processor == this_cpu).
> It's harmless for vcpu_migrate() to be called twice. It grabs locks then
> checks it has work to do (and can do that work!).

If it's calling it twice occasionally, that's fine.  But if it's calling 
it twice most of the time (and given the context I think that's 
relatively likely), I think we should try to change that.

However, that may require some careful reworking; Jan, are you OK with 
checking the current patch in as-is, and having a separate patch to try 
to remove the if and avoid the double call?

  -George

  reply	other threads:[~2013-03-04 14:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-04 12:19 [PATCH] xen: Always ask the scheduler to re-place the vcpu when the affinity changes George Dunlap
2013-03-04 12:35 ` Jan Beulich
2013-03-04 13:45   ` George Dunlap
2013-03-04 14:03     ` George Dunlap
2013-03-04 14:23       ` Keir Fraser
2013-03-04 14:22         ` George Dunlap [this message]
2013-03-04 14:58           ` Jan Beulich
2013-03-04 14:21     ` Keir Fraser

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=5134AE18.3050508@eu.citrix.com \
    --to=george.dunlap@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=dario.faggioli@citrix.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.