[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2/2] x86/time: update vtsc_last with cmpxchg and drop vtsc_lock
On Mon, Dec 16, 2019 at 12:53:40PM +0000, Igor Druzhinin wrote: > On 16/12/2019 10:00, Roger Pau Monné wrote: > > On Fri, Dec 13, 2019 at 10:48:02PM +0000, Igor Druzhinin wrote: > > I'm not sure if the following would be slightly better performance > > wise: > > > > do { > > old = d->arch.vtsc_last; > > if ( d->arch.vtsc_last >= now ) > > { > > new = atomic_inc_return(&d->arch.vtsc_last); > > break; > > } > > else > > new = now; > > } while ( cmpxchg(&d->arch.vtsc_last, old, new) != old ); > > > > In any case I'm fine with your version using cmpxchg exclusively. > > That could be marginally better (knowing that atomic increment usually > performs > better than cmpxchg) but it took me some time to work out there is no hidden > race here. I'd request a third opinion on the matter if it's worth changing. Anyway, your proposed approach using cmpxchg is fine IMO, we can leave the atomic increment for a further improvement if there's a need for it. Thanks, Roger. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |