> On Tue, Feb 19, 2008 at 02:58:51PM +0100, Andrea Arcangeli wrote:
As it turns out, no actual mutex is required. _begin_ simply increments a
count of active range invalidates, _end_ decrements the count. New TLB
dropins are deferred while range callouts are active.
This would appear to be racy but the GRU has special hardware that
simplifies locking. When the GRU sees a TLB invalidate, all outstanding
misses & potentially inflight TLB dropins are marked by the GRU with a
"kill" bit. When the dropin finally occurs, the dropin is ignored & the
instruction is simply restarted. The instruction will fault again & the TLB
dropin will be repeated. This is optimized for the case where invalidates
are rare - true for users of the GRU.
In general, though, I agree. Most users of mmu_notifiers would likely
required a mutex or something equivalent.
--- jack
--