Nick Piggin a écrit :
Again, lock / unlock operations require acquire / release consistency. This is a
memory ordering operation. It is not equivalent to smp_mb, though.
This thread just show how difficult it is to have consistent use of all this stuff in all kernel. Maybe it is just me ? Should I work on IA64 to have a chance to learn ?
For example, Documentation/atomic_ops.txt comments about atomic_inc_return() and atomic_dec_return() seems in contradiction with itself.
--------------------------
Unlike the above routines, it is required that explicit memory
barriers are performed before and after the operation. It must be
done such that all memory operations before and after the atomic
operation calls are strongly ordered with respect to the atomic
operation itself.
-------------------------
When I read this, I understand we (the user of such functions) need to add smp_mb(). (That is, those functions wont do it themselves)
Then following text is :
----------------------------
For example, it should behave as if a smp_mb() call existed both
before and after the atomic operation.
--------------------------
Now I understand the reverse.