[lkml]   [2007]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH] make atomic_t volatile on all architectures
    On Thu, 2007-08-09 at 13:36 -0400, Chuck Ebbert wrote:
    > > Fair enough. Casting to (volatile int *) will give us the behavior
    > > people expect when using atomic_t without needing to use inefficient
    > > barriers.
    > >
    > You can use this forget() macro to make the compiler reread a
    > variable:
    > #define forget(var) asm volatile ("" : "=m"(var))

    You need to specify a "m"(var) input constraint as well. Without it the
    compiler might remove the initialization of var. E.g.

    void fn(void)
    int var = 0;
    /* now var can have any value. */

    blue skies,

    "Reality continues to ruin my life." - Calvin.

    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 19:57    [W:0.022 / U:30.092 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site