Message ID | 148664871144.595.6494279719176911101.stgit@Solace.fritz.box (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Feb 9, 2017 at 1:58 PM, Dario Faggioli <dario.faggioli@citrix.com> wrote: > Since we are doing cpumask manipulation already, clear a bit > in the mask at once. Doing that will save us an if, later in > the code. > > No functional change intended. > > Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> Reviewed-by: George Dunlap <george.dunlap@citrix.com> > --- > Cc: George Dunlap <george.dunlap@eu.citrix.com> > --- > Changes from v1: > * rebased on current staging. > --- > xen/common/sched_credit2.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c > index 741d372..920a7ce 100644 > --- a/xen/common/sched_credit2.c > +++ b/xen/common/sched_credit2.c > @@ -991,7 +991,7 @@ runq_tickle(const struct scheduler *ops, struct csched2_vcpu *new, s_time_t now) > cpumask_andnot(&mask, &rqd->active, &rqd->idle); > cpumask_andnot(&mask, &mask, &rqd->tickled); > cpumask_and(&mask, &mask, cpumask_scratch_cpu(cpu)); > - if ( cpumask_test_cpu(cpu, &mask) ) > + if ( __cpumask_test_and_clear_cpu(cpu, &mask) ) > { > cur = CSCHED2_VCPU(curr_on_cpu(cpu)); > burn_credits(rqd, cur, now); > @@ -1007,8 +1007,7 @@ runq_tickle(const struct scheduler *ops, struct csched2_vcpu *new, s_time_t now) > for_each_cpu(i, &mask) > { > /* Already looked at this one above */ > - if ( i == cpu ) > - continue; > + ASSERT(i != cpu); > > cur = CSCHED2_VCPU(curr_on_cpu(i)); > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > https://lists.xen.org/xen-devel
diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index 741d372..920a7ce 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -991,7 +991,7 @@ runq_tickle(const struct scheduler *ops, struct csched2_vcpu *new, s_time_t now) cpumask_andnot(&mask, &rqd->active, &rqd->idle); cpumask_andnot(&mask, &mask, &rqd->tickled); cpumask_and(&mask, &mask, cpumask_scratch_cpu(cpu)); - if ( cpumask_test_cpu(cpu, &mask) ) + if ( __cpumask_test_and_clear_cpu(cpu, &mask) ) { cur = CSCHED2_VCPU(curr_on_cpu(cpu)); burn_credits(rqd, cur, now); @@ -1007,8 +1007,7 @@ runq_tickle(const struct scheduler *ops, struct csched2_vcpu *new, s_time_t now) for_each_cpu(i, &mask) { /* Already looked at this one above */ - if ( i == cpu ) - continue; + ASSERT(i != cpu); cur = CSCHED2_VCPU(curr_on_cpu(i));
Since we are doing cpumask manipulation already, clear a bit in the mask at once. Doing that will save us an if, later in the code. No functional change intended. Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com> --- Cc: George Dunlap <george.dunlap@eu.citrix.com> --- Changes from v1: * rebased on current staging. --- xen/common/sched_credit2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)