Messages in this thread | | | Date | Tue, 25 Apr 2006 20:11:00 +1000 | From | Nick Piggin <> | Subject | Re: [PATCH] Profile likely/unlikely macros |
| |
Andrew Morton wrote: > Daniel Walker <dwalker@mvista.com> wrote: > >> + if (likeliness->type & LIKELY_UNSEEN) { >> + if (atomic_dec_and_test(&likely_lock)) { >> + if (likeliness->type & LIKELY_UNSEEN) { >> + likeliness->type &= (~LIKELY_UNSEEN); >> + likeliness->next = likeliness_head; >> + likeliness_head = likeliness; >> + } >> + } >> + atomic_inc(&likely_lock); > > > hm, good enough I guess. It does need a comment explaining why we > don't just do spin_lock().
I guess it is so it can be used in NMIs and interrupts without turning interrupts off (so is somewhat lightweight).
But please Daniel, just use spinlocks and trylock. This is buggy because it doesn't get the required release consistency correct.
-- 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/
| |