From: "Jan Beulich" Subject: [PATCH] credit: generalize __vcpu_has_soft_affinity() Date: Wed, 04 Mar 2015 09:16:06 +0000 Message-ID: <54F6DB6602000078000660F3@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part4174EE46.2__=" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YT5Pa-0002B9-Fm for xen-devel@lists.xenproject.org; Wed, 04 Mar 2015 09:16:14 +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. --=__Part4174EE46.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 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -292,11 +292,9 @@ __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(&cpu_online_map, vc->cpu_soft_affinity) && + !cpumask_subset(vc->cpu_soft_affinity, vc->cpu_hard_affinity) = && + cpumask_intersects(vc->cpu_soft_affinity, mask); } =20 /* --=__Part4174EE46.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=0A--- a/xen/common/sched_credit.c=0A+++ b/xen/common= /sched_credit.c=0A@@ -292,11 +292,9 @@ __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(&cpu_online_map, = vc->cpu_soft_affinity) &&=0A+ !cpumask_subset(vc->cpu_soft_affini= ty, vc->cpu_hard_affinity) &&=0A+ cpumask_intersects(vc->cpu_soft= _affinity, mask);=0A }=0A =0A /*=0A --=__Part4174EE46.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 --=__Part4174EE46.2__=--