[lkml]   [2006]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRE: [patch] spinlocks: remove 'volatile'

    > Damn right. This is the C standard requirement.
    > Not all code has Linux-like performance requirements,
    > and in any case, standards are standards.

    Umm, no it's not a C standard requirement. The C standard requires
    'volatile' to work in two specific cases (signals and longjmp) and further
    defines certain side-effects of 'volatile' accesses that must not be removed
    under any 'as-if' optimizations. GCC fully respects these three

    For anything else, if you cannot detect it in a compliant program, it is
    not a violation of the standard. Programs compliant with the C standard
    cannot access shared memory that may be modified by another process nor can
    they have multiple threads concurrently executing. So any proposed violation
    that can only be exposed under those circumstances is not actually a

    POSIX, for several good reasons, did not extend 'volatile' to provide any
    guarantees when used in conjunction with things like 'mmap' and pthreads.
    For one thing, it would have added senseless expensive overhead to programs
    that used 'volatile' legitimately.

    Worse, it would have opened up the atomicity Pandora's box.

    It's hard to imagine how 'volatile' could possibly be useful in an SMP
    context if it has no atomicity guarantees, and it has no atomicity
    guarantees. No standard, as far as I know, has ever expanded 'volatile' to
    include atomicity guarantees, so it's totally and completely useless in an
    SMP context. So can this argument die now?


    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-07-09 01:13    [W:0.026 / U:237.000 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site