Re: [PATCH] Profile likely/unlikely macros
From: Nick Piggin
Date: Wed Apr 26 2006 - 12:35:54 EST
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/