Re: [RFC][PATCH 3/4] change mnt_writers[] spinlock to mutex

Dave Hansen
2008-01-10T19:11:40Z

Missed the description on that one. Here it is:

We're shortly going to need to be able to block new
mnt_writers for long periods of time during a
superblock remount operation. Since this operation
can sleep, we can not use a spinlock. We opt for
a mutex instead.

This are very, very rarely contented, mostly because
they are per-cpu. So, this should be very close to
as fast as the spinlocks just with the added benefit
that we can sleep while holding them.

We also need to change the get_cpu_var() to use
__get_cpu_var() so that we don't disable preemption.
Otherwise, we'll be in_atomic() when we try to lock
the (sleepable) mutex. We only use the per-cpu data
for cache benefits and its per-cpuness is not part
of locking logic, so this is OK.
_
-- Dave