LWN.net Logo

Memory access and alignment

Memory access and alignment

Posted Dec 6, 2007 5:00 UTC (Thu) by cventers (subscriber, #31465)
Parent article: Memory access and alignment

One place where alignment does matter on x86 is in SMP. As noted by the 
glibc documentation, aligned word-sized reads and writes are atomic on all 
known POSIX platforms. If you respect memory visibility issues, there are 
certain ways you can exploit this fact to avoid the overhead of locks. In 
fact, if you notice, the kernel's atomic_t type is pretty straightforward 
on most platforms - especially the simple read and store operations. The 
only requirement is alignment and then it is atomic for free.


(Log in to post comments)

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds