On Fri, Nov 8, 2019 at 1:57 PM Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote: > > Can we please agree to call these writes something other than > "idempotent"? After all, any write to normal memory is idempotent in > the sense that doing it twice has the same effect as doing it once > (ignoring possible races, of course). No! You're completely missing the point. Two writes to normal memory are *not* idempotent if they write different values. The ordering very much matters, and it's racy and a tool should complain. But the point of WRITE_IDEMPOTENT() is that it *always* writes the same value, so it doesn't matter if two different writers race on it. So it really is about being idempotent. > A better name would be "write-if-different" or "write-if-changed" No. Again, you're totally missing the point. It's not about "write-if-different". It's about idempotent writes. But if you do know that all the possible racing writes are idempotent, then AS A POSSIBLE CACHE OPTIMIZATION, you can then say "only do this write if somebody else didn't already do it". But that's a side effect of being idempotent, not the basic rule! And it's not necessarily obviously an optimization at all, because the cacheline may already be dirty, and checking the old value and having a conditional on it may be much more expensive than just writing the new value./ The point is that certain writes DO NOT CARE ABOUT ORDERING, because they may be setting a sticky flag (or stickily clearing a flag, as in this case). The ordering doesn't matter, because the operation is idempotent. That's what "idempotent" means. You can do it once, or a hundred times, and the end result is the same (but is different from not doing it at all). And no, not all writes are idempotent. That's just crazy talk. Writes have values. Linus