LWN.net Logo

Likely unlikely()s

Likely unlikely()s

Posted Dec 16, 2010 20:21 UTC (Thu) by cras (guest, #7000)
In reply to: Likely unlikely()s by vonbrand
Parent article: Likely unlikely()s

Of course. But if there are some heavily used macros and functions where it's easy to add them once and then get them used throughout the code, it's not much extra trouble even if the benefit is small.

Although now that I think about it, maybe many of those checks I used to put unlikely() in my code are nowadays pointless, because they call functions that I've since marked with __attribute__((cold)), which should put the unlikely()s there automatically. (But do they? I remember testing that the cold attribute did nothing in some gcc version.)


(Log in to post comments)

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