Messages in this thread | | | Date | Wed, 26 Apr 2006 20:07:47 +1000 | From | Nick Piggin <> | Subject | Re: [PATCH] Profile likely/unlikely macros |
| |
Jörn Engel wrote:
> Admitted, I'm a bit slow at times. But why does this matter? > According to my fairly limited brain, you take a potentially expensive > barrier, so you pay with a bit of runtime. What you buy is a smaller > critical section, so you can save some runtime on other cpus. When > optimizing for the common case, which is one cpu, this is a net loss. > > There must be some correctness issue hidden that I cannot see. Can > you explain that to me?
Another CPU may find the bit clear, enter the critical section, and load the old `likeliness_head' (value before being changed by this CPU).
Then it stores the old value to likeliness->next, and overwrites likeliness_head.
One CPU's update has now gotten lost.
(there are probably other examples, like missing likliness->type)
-- SUSE Labs, Novell Inc. Send instant messages to your online friends http://au.messenger.yahoo.com - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |