[lkml]   [2007]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH] make atomic_t volatile on all architectures
    Chris Snook <> wrote:
    > Some architectures currently do not declare the contents of an atomic_t to be
    > volatile. This causes confusion since atomic_read() might not actually read
    > anything if an optimizing compiler re-uses a value stored in a register, which
    > can break code that loops until something external changes the value of an
    > atomic_t. Avoiding such bugs requires using barrier(), which causes re-loads

    Such loops should always use something like cpu_relax() which comes
    with a barrier.

    > of all registers used in the loop, thus hurting performance instead of helping
    > it, particularly on architectures where it's unnecessary. Since we generally

    Do you have an example of such a loop where performance is hurt by this?

    The IPVS code that led to this patch was simply broken and has been
    fixed to use cpu_relax().

    Visit Openswan at
    Email: Herbert Xu ~{PmV>HI~} <>
    Home Page:
    PGP Key:
    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: 2007-08-09 03:09    [W:0.042 / U:49.928 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site