Re: [Patch 3/3] prepopulate/cache cleared pages

From: Ingo Molnar
Date: Thu Feb 23 2006 - 08:29:07 EST



* Nick Piggin <nickpiggin@xxxxxxxxxxxx> wrote:

> I'm worried about the situation where we allocate but don't use the
> new page: it blows quite a bit of cache. Then, when we do get around
> to using it, it will be cold(er).

couldnt the new pte be flipped in atomically via cmpxchg? That way we
could do the page clearing close to where we are doing it now, but
without holding the mmap_sem.

to solve the pte races we could use a bit in the [otherwise empty] pte
to signal "this pte can be flipped in from now on", which bit would
automatically be cleared if mprotect() or munmap() is called over that
range (without any extra changes to those codepaths). (in the rare case
if the cmpxchg() fails, we go into a slowpath that drops the newly
allocated page, re-lookups the vma and the pte, etc.)

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/