Re: [PATCH] drm: Take mmap_sem up front to avoid lock order violations.
From: Nick Piggin
Date: Thu Feb 19 2009 - 10:17:24 EST
On Thu, Feb 19, 2009 at 09:49:40AM -0500, Kristian Høgsberg wrote:
>
> > Secondly, mmap_sem is not a recursive lock (very few kernel locks are,
> > and we generally frown upon recursive locking schemes), this means that
> > the fault handler still cannot function properly.
>
> I understand, but we take it twice only as a read lock, so that should
> work, right? We prevent the deadlock the lockdep validator warned about
> and as far as I can see, the patch doesn't introduce a new one. But
> other than that I agree with the frowning on recursive locking, it's too
> often used to paper over badly thought out locking.
It doesn't work. rwsems are fair (otherwise there is terrible starvation
properties), so if another process does an interleaved down_write, then
the 2nd down_read will block until the down_write is serviced.
--
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/