Re: [PATCH] reserved buffers only for PF_MEMALLOC

From: Marcelo Tosatti
Date: Tue Aug 10 2004 - 15:58:24 EST


On Tue, Aug 10, 2004 at 03:42:32PM -0500, Matt Domsch wrote:
> On Tue, Aug 10, 2004 at 04:04:55PM -0300, Marcelo Tosatti wrote:
> > On Tue, Aug 10, 2004 at 01:20:24PM -0400, Rik van Riel wrote:
> > >
> > > The buffer allocation path in 2.4 has a long standing bug,
> > > where non-PF_MEMALLOC tasks can dig into the reserved pool
> > > in get_unused_buffer_head(). The following patch makes the
> > > reserved pool only accessible to PF_MEMALLOC tasks.
> >
> > Out of curiosity: Do you actually seen any practical problem due to
> > get_unused_buffer_head() calls eating into the reserved pool?
> >
> > Or have any testcase which would trigger a problem (OOM) due to it?
>
> My team has seen an application which mallocs as much memory as
> possible, up to 95% of system RAM, using multiple processes as
> necessary, and then has threads which touch all the malloc'd bytes and
> threads which touch all the malloc'd pages. It keeps kswapd pretty
> busy, such that you can get down to zero free and inactive clean
> ZONE_NORMAL pages from which to allocate additional buffer_heads for
> swapout, deadlocking the system.
>
> We believe that by limiting the use of the reserved buffer_head pool
> to PF_MEMALLOC tasks like kswapd, kswapd can make forward progress
> even in extremely low memory situations.

OK, makes sense. I assume Rik's patch fixes the deadlock you are seeing?

Have you tested it?

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