From: "Jan Beulich" Subject: [PATCH v2] credit: generalize __vcpu_has_soft_affinity() Date: Fri, 06 Mar 2015 07:36:59 +0000 Message-ID: <54F9672B0200007800066D4A@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part97A2370B.2__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YTmoh-00069U-75 for xen-devel@lists.xenproject.org; Fri, 06 Mar 2015 07:37:03 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: George Dunlap , Dario Faggioli List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part97A2370B.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline As pointed out in the discussion of the patch at http://lists.xenproject.org/archives/html/xen-devel/2015-02/msg03256.html= =20 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); } =20 /* --=__Part97A2370B.2__= Content-Type: text/plain; name="credit-has-soft-affinity.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="credit-has-soft-affinity.patch" credit: generalize __vcpu_has_soft_affinity()=0A=0AAs pointed out in the = discussion of the patch at=0Ahttp://lists.xenproject.org/archives/html/xen-= devel/2015-02/msg03256.html=0Ageneralizing the conditions here means code = elsewhere doesn't need to=0Atake into consideration internals of how load = balancing in the credit=0Ascheduler works.=0A=0ASigned-off-by: Jan Beulich = =0A---=0Av2: Use VCPU2ONLINE(vc) (or really an open = coded variant thereof)=0A instead of cpu_online_map (suggested by = Dario).=0A=0A--- a/xen/common/sched_credit.c=0A+++ b/xen/common/sched_credi= t.c=0A@@ -292,11 +292,10 @@ __runq_remove(struct csched_vcpu *svc)=0A = static inline int __vcpu_has_soft_affinity(const struct vcpu *vc,=0A = const cpumask_t *mask)=0A {=0A- if = ( cpumask_full(vc->cpu_soft_affinity)=0A- || !cpumask_intersects(vc= ->cpu_soft_affinity, mask) )=0A- return 0;=0A-=0A- return 1;=0A+ = return !cpumask_subset(cpupool_online_cpumask(vc->domain->cpupool),=0A+ = vc->cpu_soft_affinity) &&=0A+ = !cpumask_subset(vc->cpu_soft_affinity, vc->cpu_hard_affinity) &&=0A+ = cpumask_intersects(vc->cpu_soft_affinity, mask);=0A }=0A =0A /*=0A --=__Part97A2370B.2__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part97A2370B.2__=--