[rfc][patch] mm: madvise(WILLNEED) for anonymous memory

2007-12-20 Thread Peter Zijlstra
Hi, Lennart asked for madvise(WILLNEED) to work on anonymous pages, he plans to use this to pre-fault pages. He currently uses: mlock/munlock for this purpose. [ compile tested only ] Signed-off-by: Peter Zijlstra [EMAIL PROTECTED] --- diff --git a/mm/madvise.c b/mm/madvise.c index

Re: [rfc][patch] mm: madvise(WILLNEED) for anonymous memory

2007-12-20 Thread Hugh Dickins
On Thu, 20 Dec 2007, Peter Zijlstra wrote: Lennart asked for madvise(WILLNEED) to work on anonymous pages, he plans to use this to pre-fault pages. He currently uses: mlock/munlock for this purpose. I certainly agree with this in principle: it just seems an unnecessary and surprising

Re: [rfc][patch] mm: madvise(WILLNEED) for anonymous memory

2007-12-20 Thread Peter Zijlstra
On Thu, 2007-12-20 at 14:09 +, Hugh Dickins wrote: On Thu, 20 Dec 2007, Peter Zijlstra wrote: Lennart asked for madvise(WILLNEED) to work on anonymous pages, he plans to use this to pre-fault pages. He currently uses: mlock/munlock for this purpose. I certainly agree with this in

Re: [rfc][patch] mm: madvise(WILLNEED) for anonymous memory

2007-12-20 Thread Peter Zijlstra
On Thu, 2007-12-20 at 15:47 +0100, Peter Zijlstra wrote: On Thu, 2007-12-20 at 14:09 +, Hugh Dickins wrote: Interesting divergence: make_pages_present faults in writable pages in a writable vma, whereas the file case's force_page_cache_readahead doesn't even insert the pages into the

Re: [rfc][patch] mm: madvise(WILLNEED) for anonymous memory

2007-12-20 Thread Peter Zijlstra
On Thu, 2007-12-20 at 15:56 +0100, Peter Zijlstra wrote: On Thu, 2007-12-20 at 15:47 +0100, Peter Zijlstra wrote: On Thu, 2007-12-20 at 14:09 +, Hugh Dickins wrote: Interesting divergence: make_pages_present faults in writable pages in a writable vma, whereas the file case's

Re: [rfc][patch] mm: madvise(WILLNEED) for anonymous memory

2007-12-20 Thread Peter Zijlstra
On Thu, 2007-12-20 at 16:18 +0100, Peter Zijlstra wrote: +static int madvise_willneed_anon_pte(pte_t *ptep, + unsigned long start, unsigned long end, void *arg) +{ + struct vm_area_struct *vma = arg; + struct page *page; + + page =

Re: [rfc][patch] mm: madvise(WILLNEED) for anonymous memory

2007-12-20 Thread Hugh Dickins
On Thu, 20 Dec 2007, Peter Zijlstra wrote: On Thu, 2007-12-20 at 14:09 +, Hugh Dickins wrote: On Thu, 20 Dec 2007, Peter Zijlstra wrote: I certainly agree with this in principle: it just seems an unnecessary and surprising restriction to refuse on anonymous vmas; I guess the only

Re: [rfc][patch] mm: madvise(WILLNEED) for anonymous memory

2007-12-20 Thread Lennart Poettering
On Thu, 20.12.07 14:09, Hugh Dickins ([EMAIL PROTECTED]) wrote: Lennart asked for madvise(WILLNEED) to work on anonymous pages, he plans to use this to pre-fault pages. He currently uses: mlock/munlock for this purpose. I certainly agree with this in principle: it just seems an

Re: [rfc][patch] mm: madvise(WILLNEED) for anonymous memory

2007-12-20 Thread Peter Zijlstra
On Thu, 2007-12-20 at 15:26 +, Hugh Dickins wrote: The asynch code: perhaps not worth doing for MADV_WILLNEED alone, but might prove useful for more general use when swapping in. Not really the same as Con's swap prefetch, but worth looking at that for reference. But I guess this

Re: [rfc][patch] mm: madvise(WILLNEED) for anonymous memory

2007-12-20 Thread Matt Mackall
On Thu, Dec 20, 2007 at 05:53:41PM +0100, Peter Zijlstra wrote: On Thu, 2007-12-20 at 15:26 +, Hugh Dickins wrote: The asynch code: perhaps not worth doing for MADV_WILLNEED alone, but might prove useful for more general use when swapping in. Not really the same as Con's swap

Re: [rfc][patch] mm: madvise(WILLNEED) for anonymous memory

2007-12-20 Thread Peter Zijlstra
On Thu, 2007-12-20 at 11:11 -0600, Matt Mackall wrote: On Thu, Dec 20, 2007 at 05:53:41PM +0100, Peter Zijlstra wrote: On Thu, 2007-12-20 at 15:26 +, Hugh Dickins wrote: The asynch code: perhaps not worth doing for MADV_WILLNEED alone, but might prove useful for more general