Re: [2.6.27-rc5] inotify_read's ev_mutex vs do_page_fault'smmap_sem...

From: Ingo Molnar
Date: Wed Sep 10 2008 - 04:38:21 EST



* Nick Piggin <nickpiggin@xxxxxxxxxxxx> wrote:

> On Wednesday 10 September 2008 17:57, Peter Zijlstra wrote:
> > On Wed, 2008-09-10 at 14:07 +1000, Nick Piggin wrote:
> > > On Wednesday 10 September 2008 07:03, Daniel J Blueman wrote:
> > > > I observed this locking violation [1] while gnome-panel was loading;
> > > > this was previously reported at
> > > > http://uwsg.iu.edu/hypermail/linux/kernel/0806.3/2881.html .
> > > >
> > > > Let me know for more information/config/testing. Thanks!
> > >
> > > Thanks for the report. I've attached a patch you could test. It compiles
> > > (and boots a UML here) but I don't think I've actually tested the inotify
> > > path at all, so it may explode on you.
> > >
> > > Peter, this copy_*_user stuff is quite a nightmare... Well actually it
> > > isn't, if the code is designed with it in mind from the start, but it is
> > > easy for people to forget it can take mmap_sem and filesystem locks... Is
> > > there a way to annotate it and say "might take mmap_sem for read" for
> > > example? So that these LORs will _always_ trigger rather than just once
> > > in a million times when the reclaim gods frown on us?
> >
> > Sure, how about the below - untested - uncompiled, might eat kittens,
> > etc..
> >
> > Just sprinkle something like:
> >
> > might_lock_read(&mm->mmap_sem);
> >
> > in the right places.
>
> Ahh, very nice, thanks! I'll give that a try...

cool! Please send in an RFC patch once you have something that boots -
we can stick it into tip/core/locking and see whether there's any new
messages on a wide range of systems and workloads. (and we'd also check
whether the number of kittens is an invariant.)

Ingo
--
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/