Re: [PATCH] mm: MADV_WILLNEED implementation for anonymous memory

From: Andi Kleen
Date: Thu Jan 31 2008 - 05:58:18 EST


On Thu, Jan 31, 2008 at 05:52:09AM -0500, Rik van Riel wrote:
> On Thu, 31 Jan 2008 12:06:10 +0100
> Andi Kleen <andi@xxxxxxxxxxxxxx> wrote:
>
> > > Yeah, the 2.5 switch to physical scanning killed us there.
> > >
> > > I still don't know why my
> > > allocate-swapspace-according-to-virtual-address change didn't
> > > help. Much. Marcelo played with that a bit too.
> >
> > I've been thinking about just always doing swap on > page clusters.
> > Any reason swapping couldn't be done on e.g. 1MB chunks?
>
> Don't malloc() and free() hopelessly fragment memory
> over time, ensuring that little related data can be
> found inside each 1MB chunk if the process is large
> enough? (say, firefox)

Even if they do (I don't know if it's true or not) it does not really
matter because on modern hard disks/systems it does not cost less to
transfer 1MB versus 4K. The actual threshold seems to be rising in fact.

The only drawback is that the swap might be full sooner, but
I would actually consider this a feature because it would likely
end many prolonged oom death dances much sooner.

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