Hmm, I might just withdraw this patch 1/5. This is generally a slowpath,
and it's hard to guarantee that any exported user doesn't rely on the
full barrier here (not that they would know whether they do or not, let
alone document the fact).
If you set a bit for the purpose of opening a critical section, then
you can use this. And clear_bit_unlock to close it.
The advantages are that it is faster, and the hapless driver writer
doesn't have to butcher or forget about doing the correct
smp_mb__before_clear_bit(), or have reviewers wondering exactly WTF
that barrier is for, etc.
Basically, it is faster, harder to get wrong, and more self-docuemnting.
In general, others should not emulate it, because they should be
using our regular locking primitives instead. If they really must
2/5: "tasklet_trylock opens a critical section. tasklet_unlock closes it.
hence, _lock bitops can be used for the bitops"
5/5: "trylock_page opens a critical section. unlock_page closes it. hence,
_lock bitops can be used for the bitops"
5/5: "trylock_buffer opens a critical section. unlock_buffer closes it.
hence, _lock bitops can be used for the bitops"
Are those helpful?
-