Re: atomics: document that linux expects certain atomic behaviour from unsigned long

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Is there concrete architecture where it breaks? I'd expect i386/x86-64
> to be safe, and pretty much everyone to be safe as long as that long
> is aligned.... or that was the result of arch-maintainers
> discussion...

It'll break on x86 if gcc decides to cache the value and you don't have
explicit barriers. If the long is not aligned it's not safe on x86 at all.
 
> I'd really like to document if it is right or not, so that I can point
> people to documentation...

We should always tell people to use atomic/set_bit etc. There *are* cases
you can get away with it but it is far far better that the default is the
safe one because most driver writers do not have a detailed knowledge of
gcc code generation, processor quirks and barriers. If in a specific case
its a performance hit then its worth optimising that case.

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux