Hello, likely and unlikely macros is used to make compiler give "hints" about conditional instructions(branches usually) to the processor, if of course processor's architecture supports it. With these macros, compiler/processor use them for branch prediction algorithm to minimize the needed pipeline's stalls, making faster the application from the view of programmer. Branch prediction hit rate is really hi,if I am not wrong something like 99%,so it's needed to give hits on our branches only if we are sure that we can achieve more. Finally these macros are (usually) used: -On error handing tests (errors are unlikely to happen) -On tests that we want to make faster the common path, and not care if we have higher overhead on the other one. In terms of correctness, these macros are not needed, they are only used by optimization reasons. Also their wrong use cause only worse performance, and never affect correctness. Stavros Passas On Fri, 2006-11-24 at 10:56 -0500, Manoj Awasthi wrote: > Hi, > > Can someone please tell me the cases in which we can use likely() and > unlikely() macros ? > I think this optimization is at the cost of the correctness of code > handling. > > thanks > -Manoj > -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/