From: Keir Fraser Subject: Re: [PATCH] xen: Always ask the scheduler to re-place the vcpu when the affinity changes Date: Mon, 04 Mar 2013 14:21:37 +0000 Message-ID: References: <5134A570.7050604@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5134A570.7050604@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George Dunlap , Jan Beulich Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On 04/03/2013 13:45, "George Dunlap" wrote: >> The code right below the context visible here is >> >> if ( test_bit(_VPF_migrating, &v->pause_flags) ) >> { >> vcpu_sleep_nosync(v); >> vcpu_migrate(v); >> } >> >> and I think the conditional could (and should) now be removed. > > Yeah, I wasn't sure what to make of that one -- it looked as though it > was coded such that someone else might be able to clear _VPF_migrating > between releasing the lock and this test. But if that can happen, it's > racy anyway. vcpu_force_reschedule() has this "set, unlock, re-check" > pattern. > > It looks like there actually is a way that it could conceivably be > cleared: if the vcpu is running on another pcpu, if after we release the > lock the vcpu is de-scheduled and context_saved() is called, it will > check for _VPF_migrating and call vcpu_migrate(), which can clear the flag. > > But that's probably a rare enough occurrence that it's better overall to > take the occasional double-migrate. Yes, the check is safe to remove, or indeed safe to keep. -- Keir