In general, you can run into problems where the counter is being incremented as it is being read. Say you're using a (mythical) 8-bit architecture, and the 16-bit counter value is being incremented from 0x00ff to 0x0100. The intermediate state, as the counter is being updated, will be 0x0000 (or perhaps 0x01ff) because only 8 bits are being written at a time. Much worse than the off-by-one situation that I think you were imagining. And worse still if it is a 64 bit counter on a 32 bit system...
Caveat- I don't know anything the specific types mentioned in the article (local_t in particular) so this particular problem might not be an issue there depending on how the atomicity of it works.
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds