* [PATCH] credit: generalize __vcpu_has_soft_affinity()
@ 2015-03-04 9:16 Jan Beulich
2015-03-04 12:08 ` Dario Faggioli
0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2015-03-04 9:16 UTC (permalink / raw)
To: xen-devel; +Cc: George Dunlap, Dario Faggioli
[-- Attachment #1: Type: text/plain, Size: 986 bytes --]
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 <jbeulich@suse.com>
--- 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);
}
/*
[-- Attachment #2: credit-has-soft-affinity.patch --]
[-- Type: text/plain, Size: 1028 bytes --]
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.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- 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);
}
/*
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] credit: generalize __vcpu_has_soft_affinity()
2015-03-04 9:16 [PATCH] credit: generalize __vcpu_has_soft_affinity() Jan Beulich
@ 2015-03-04 12:08 ` Dario Faggioli
2015-03-04 12:53 ` Jan Beulich
0 siblings, 1 reply; 3+ messages in thread
From: Dario Faggioli @ 2015-03-04 12:08 UTC (permalink / raw)
To: JBeulich@suse.com; +Cc: xen-devel@lists.xenproject.org, George Dunlap
[-- Attachment #1.1: Type: text/plain, Size: 876 bytes --]
On Wed, 2015-03-04 at 09:16 +0000, Jan Beulich wrote:
> --- 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) &&
>
This can use VCPU2ONLINE(vc). Or do you think the impact of one more if
(the ?: in cpupool_online_cpumask) would be too much?
> + !cpumask_subset(vc->cpu_soft_affinity, vc->cpu_hard_affinity) &&
> + cpumask_intersects(vc->cpu_soft_affinity, mask);
> }
>
Regards,
Dario
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] credit: generalize __vcpu_has_soft_affinity()
2015-03-04 12:08 ` Dario Faggioli
@ 2015-03-04 12:53 ` Jan Beulich
0 siblings, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2015-03-04 12:53 UTC (permalink / raw)
To: Dario Faggioli; +Cc: xen-devel@lists.xenproject.org, George Dunlap
>>> On 04.03.15 at 13:08, <dario.faggioli@citrix.com> wrote:
> On Wed, 2015-03-04 at 09:16 +0000, Jan Beulich wrote:
>> --- 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) &&
>>
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-04 12:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-04 9:16 [PATCH] credit: generalize __vcpu_has_soft_affinity() Jan Beulich
2015-03-04 12:08 ` Dario Faggioli
2015-03-04 12:53 ` Jan Beulich
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.