From: "Jan Beulich" Subject: Re: [PATCH v2] credit: generalize __vcpu_has_soft_affinity() Date: Fri, 06 Mar 2015 10:16:34 +0000 Message-ID: <54F98C920200007800066EC5@mail.emea.novell.com> References: <54F9672B0200007800066D4A@mail.emea.novell.com> <54F9792A.7030605@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YTpJ5-00044W-JD for xen-devel@lists.xenproject.org; Fri, 06 Mar 2015 10:16:35 +0000 In-Reply-To: <54F9792A.7030605@eu.citrix.com> Content-Disposition: inline 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 Cc: xen-devel , Dario Faggioli List-Id: xen-devel@lists.xenproject.org >>> On 06.03.15 at 10:53, wrote: > On 03/06/2015 07:36 AM, Jan Beulich wrote: >> As pointed out in the discussion of the patch at >> http://lists.xenproject.org/archives/html/xen-devel/2015-02/msg03256.html >> generalizing the conditions here means code elsewhere doesn't need to >> take into consideration internals of how load balancing in the credit >> scheduler works. >> >> Signed-off-by: Jan Beulich >> --- >> v2: Use VCPU2ONLINE(vc) (or really an open coded variant thereof) >> instead of cpu_online_map (suggested by Dario). >> >> --- a/xen/common/sched_credit.c >> +++ b/xen/common/sched_credit.c >> @@ -292,11 +292,10 @@ __runq_remove(struct csched_vcpu *svc) >> static inline int __vcpu_has_soft_affinity(const struct vcpu *vc, >> const cpumask_t *mask) >> { >> - if ( cpumask_full(vc->cpu_soft_affinity) >> - || !cpumask_intersects(vc->cpu_soft_affinity, mask) ) >> - return 0; >> - >> - return 1; >> + return !cpumask_subset(cpupool_online_cpumask(vc->domain->cpupool), >> + vc->cpu_soft_affinity) && >> + !cpumask_subset(vc->cpu_soft_affinity, vc->cpu_hard_affinity) && >> + cpumask_intersects(vc->cpu_soft_affinity, mask); > > It looks like the comment above this line could use changing too; perhaps: > > --- > Hard affinity balancing is always necessary and must never be skipped. > But soft affinity need only be considered when it has a functionally > different effect than other constraints (such as hard affinity, cpus > online, or cpupools). > > Soft affinity only needs to be considered if: > * The cpus in the cpupool are not a subset of soft affinity > * The hard affinity is not a subset of soft affinity "hard" and "soft" appear to be swapped here. I corrected this, please let me know if you disagree (in which case the patch would need changing too). > * There is an overlap between the soft affinity and the mask which is > currently being considered. > --- > > With the comment updated: > > Reviewed-by: George Dunlap Thanks, Jan