credit: generalize __vcpu_has_soft_affinity()
PATCH 1/1 credit: generalize __vcpu_has_soft_affinity()
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.
xen/common/sched_credit.c +3 -5
@@ -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); }/*
credit: generalize __vcpu_has_soft_affinity()
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.
xen/common/sched_credit.c +3 -5
@@ -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); }/*
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
xen/common/sched_credit.c __runq_remove(struct csched_vcpu *svc) · line 296
Quoted 13 lines · Jan Beulich
xen/common/sched_credit.c +1
-5@@ -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) &&
This can use VCPU2ONLINE(vc). Or do you think the impact of one more if (the ?: in cpupool_online_cpumask) would be too much?
xen/common/sched_credit.c __runq_remove(struct csched_vcpu *svc) · line 299
Quoted 4 lines
xen/common/sched_credit.c +2
-0+ !cpumask_subset (vc->cpu_soft_affinity, vc->cpu_hard_affinity) && +cpumask_intersects (vc->cpu_soft_affinity, mask); }
Regards,
Dario
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 04.03.15 at 13:08, <[email protected]> wrote:
xen/common/sched_credit.c __runq_remove(struct csched_vcpu *svc) · line 296
Quoted 13 lines · Jan Beulich
xen/common/sched_credit.c +1
-5@@ -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) &&This can use VCPU2ONLINE(vc). Or do you think the impact of one more if (the ?: in
cpupool_online_cpumask) would be too much?
No, I think that would be fine. I simply wasn't aware of the construct. v2 soon to come.
Jan