This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

benchmark for atomic.


On Mon, Dec 16, 2013 at 10:23:34PM +0100, OndÅej BÃlka wrote:
> > 
> > > Second problem is that fastbins are per-arena not per-thread which
> > > forces us to use atomic operations. These are expensive (typicaly more than 50 cycles).
> > 
> > Especially on x86, atomic operations that *hit in the cache* have become
> > very fast compared to their costs in the past.  I don't have current
> > numbers, but I believe the 50 cycle number is too high; I vaguely
> > remember 10-20.
> 
> A simple benchmark could check a real cost. A problem is that while for core2
> and i7 cost of CAS is around 20 cycles for bulldozer its still 50 cycles.
> 
> Even with these a malloc+free pair contains 5 atomic instructions on
> fastbin path which gives 100 cycle penalty (malloc: lock, get item from bin, unlock,
> free: set bit that fastbins are in use, put item to bin) 
> 
A benchmark for performance of CAS is here.

Attachment: atomic.c
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]