Re: [patch 9/9] mm: fix pagecache write deadlocks

From: Andrew Morton
Date: Sun Feb 04 2007 - 06:16:27 EST


On Sun, 4 Feb 2007 12:03:17 +0100 Nick Piggin <npiggin@xxxxxxx> wrote:

> On Sun, Feb 04, 2007 at 02:56:02AM -0800, Andrew Morton wrote:
> > On Sun, 4 Feb 2007 11:46:09 +0100 Nick Piggin <npiggin@xxxxxxx> wrote:
> >
> > > On Sun, Feb 04, 2007 at 02:30:55AM -0800, Andrew Morton wrote:
> > > > On Sun, 4 Feb 2007 11:15:29 +0100 Nick Piggin <npiggin@xxxxxxx> wrote:
> > > >
> > > > > The write path is broken. I prefer my kernels slow, than buggy.
> > > >
> > > > That won't fly.
> > >
> > > What won't fly?
> >
> > I suspect the performance cost of this approach would force us to redo it
> > all.
>
> That's the idea. But at least in the meantime we're correct.

There's no way I'd support merging a change which we know we'll have to
redo only we have no clue how.

> > If that recollection is right, I think we could afford to reintroduce that
> > problem, frankly. Especially as it only happens in the incredibly rare
> > case of that get_user()ed page getting unmapped under our feet.
>
> Dang. I was hoping to fix it without introducing data corruption.

Well. It's a compromise. Being practical about it, I reeeealy doubt that
anyone will hit this combination of circumstances.

> > > > > but you introduce the theoretical memory deadlock
> > > > > where a task cannot reclaim its own memory.
> > > >
> > > > Nah, that'll never happen - both pages are already allocated.
> > >
> > > Both pages? I don't get it.
> > >
> > > You set the don't-reclaim vma flag, then run get_user, which takes a
> > > page fault and potentially has to allocate N pages for pagetables,
> > > pagecache readahead, buffers and fs private data and pagecache radix
> > > tree nodes for all of the pages read in.
> >
> > Oh, OK. Need to do the get_user() twice then. Once before taking that new
> > rwsem.
>
> Race condition remains.

No, not in a million years.
-
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/