lkml.org 
[lkml]   [2006]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [patch 1/2] atomic_add_unless sadness


    On Wed, 18 Jan 2006, Nick Piggin wrote:
    >
    > For some reason gcc 4 on at least i386 and ppc64 (that I have tested with)
    > emit two cmpxchges for atomic_add_unless unless we put branch hints in.
    > (it is unlikely for the "unless" case to trigger, and it is unlikely for
    > cmpxchg to fail).

    Irrelevant. If "atomic_add_unless()" is in a hot path and inlined, we're
    doing something else wrong anyway. It's not a good op to use. Just think
    of it as being very expensive.

    The _only_ user of "atomic_add_unless()" is "dec_and_lock()", which isn't
    even inlined. The fact that gcc ends up "unrolling" the loop once is just
    fine.

    Please keep it that way.

    Linus
    -
    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/

    \
     
     \ /
      Last update: 2009-11-18 23:46    [W:0.025 / U:35.156 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site