On Wed, Aug 3, 2011 at 7:37 AM, Mulyadi Santosa <mulyadi.santosa@gmail.com> wrote:
Dear Julie....
On Tue, Aug 2, 2011 at 04:28, Julie Sullivan <kernelmail.jms@gmail.com> wrote:
Specifically, the conditional
if (t->rcu_read_lock_nesting == 0 && unlikely(ACCESS_ONCE(t->rcu_read_unlock_special))) rcu_read_unlock_special(t);
I've googled for 'likely/unlikely' and i've seen
if (unlikely(...
before in kernel code, and I might understand if the logical operator here were || not &&, but why is the 'unlikely' attribute only applied to the second operand here?
i guess that's because first condition "t->rcu_read_lock_nesting == 0" has about 50%-50% chance.... so putting likely() or unlikely() has no use here...
i read somewhere (or maybe someone's opinion) that you only use likely() or unlikely() if you are about above 90% (or maybe...if possible 99%) sure that condition will be true or false....otherwise, avoid likely()/unlikely() and let the compiler+processor do the usual ordering/branch prediction.
just my 2 cents...
-- regards,
Mulyadi Santosa Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com
Thanks Mulyadi, maybe someday when I get round to performance testing I'll try this out for myself... Cheers Julie