[lkml]   [2006]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH] Profile likely/unlikely macros
    Daniel Walker wrote:

    >On Tue, 2006-04-25 at 20:11 +1000, Nick Piggin wrote:
    >>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.
    >To use spinlock we would need to used the __raw_ types . As Hua
    >explained all of the vanilla spinlock calls use the unlikely macro. The
    >result is that we end up using atomic operations. So using them directly
    >seems like the cleanest method .

    Ah, I see. Then you should be OK with either your current scheme, or
    Andrew's suggestion, so long as you have a memory barrier before the
    unlock (eg. smp_mb__before_clear_bit()).

    >I'm not exactly sure what you mean by "release consistency" ?

    Without a barrier, the stores to the linked list may be visible to another
    CPU after the store that unlocks the atomic_t. Ie. the critical section can
    leak out of the lock.


    Send instant messages to your online friends

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2006-04-26 03:13    [W:0.021 / U:36.940 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site