Posted Dec 27, 2010 10:54 UTC (Mon) by tesarik (guest, #52705)
In reply to: Likely unlikely()s by giraffedata
Parent article: Likely unlikely()s
Well, let's give a better example of this. Consider a spinlock slow
path (ie. on contention):
while(unlikely(is_locked(lock)))
cpu_relax();
Although it's likely that the lock is held many times before we can take it,
it's more important to run the critical section as fast as possible when it
finally gets available.