[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xen: credit2: clear bit instead of skip step in runq_tickle()



On Wed, 2017-01-18 at 03:30 -0700, Jan Beulich wrote:
> > > > On 18.01.17 at 11:21, <george.dunlap@xxxxxxxxxx> wrote:
> > On 18/01/17 00:30, Dario Faggioli wrote:
> > > 
> > > --- a/xen/common/sched_credit2.c
> > > +++ b/xen/common/sched_credit2.c
> > > @@ -985,7 +985,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, new->vcpu->cpu_hard_affinity);
> > > -    if ( cpumask_test_cpu(cpu, &mask) )
> > > +    if ( __cpumask_test_and_clear_cpu(cpu, &mask) )
> > 
> > Since we're micro-optimizing -- isn't test-and-clear a locked
> > operation?
> >  Would that be more expensive than the if() statement below?
> 
> cpumask_test_and_clear_cpu() is, but __cpumask_test_and_clear_cpu()
> isn't.
> 
As Jan said.

And, FWIW, I personally like how the code looks after this patch
better, even leaving aside performance.

I find it cleaner (probably because dislike 'continue'), and more in
line with what we do in the rest of the file.

Thanks and Regadrs,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.