User: Password:
|
|
Subscribe / Log in / New account

Likely unlikely()s

Likely unlikely()s

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.


(Log in to post comments)


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds