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

From: Dave Hansen
Date: Thu Jan 10 2008 - 14:11:40 EST


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/