Re: [patch]mm: make madvise(MADV_WILLNEED) support swap file prefetch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 07, 2013 at 12:06:30PM -0800, Andrew Morton wrote:
>On Mon, 7 Jan 2013 16:12:37 +0800
>Shaohua Li <shli@xxxxxxxxxx> wrote:
>
>> 
>> Make madvise(MADV_WILLNEED) support swap file prefetch. If memory is swapout,
>> this syscall can do swapin prefetch. It has no impact if the memory isn't
>> swapout.
>
>Seems sensible.

Hi Andrew and Shaohua,

What's the performance in the scenario of serious memory pressure? Since
in this case pages in swap are highly fragmented and cache hit is most
impossible. If WILLNEED path should add a check to skip readahead in
this case since swapin only leads to unnecessary memory allocation. 

Regards,
Wanpeng Li 

>
>> @@ -140,6 +219,18 @@ static long madvise_willneed(struct vm_a
>>  {
>>  	struct file *file = vma->vm_file;
>>  
>> +#ifdef CONFIG_SWAP
>
>It's odd that you put the ifdef in there, but then didn't test it!
>
>
>From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
>Subject: mm-make-madvisemadv_willneed-support-swap-file-prefetch-fix
>
>fix CONFIG_SWAP=n build
>
>Cc: Shaohua Li <shli@xxxxxxxxxxxx>
>Cc: Hugh Dickins <hughd@xxxxxxxxxx>
>Cc: Rik van Riel <riel@xxxxxxxxxx>
>Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
>---
>
> mm/madvise.c |    2 ++
> 1 file changed, 2 insertions(+)
>
>diff -puN mm/madvise.c~mm-make-madvisemadv_willneed-support-swap-file-prefetch-fix mm/madvise.c
>--- a/mm/madvise.c~mm-make-madvisemadv_willneed-support-swap-file-prefetch-fix
>+++ a/mm/madvise.c
>@@ -134,6 +134,7 @@ out:
> 	return error;
> }
>
>+#ifdef CONFIG_SWAP
> static int swapin_walk_pmd_entry(pmd_t *pmd, unsigned long start,
> 	unsigned long end, struct mm_walk *walk)
> {
>@@ -209,6 +210,7 @@ static void force_shm_swapin_readahead(s
>
> 	lru_add_drain();	/* Push any new pages onto the LRU now */
> }
>+#endif		/* CONFIG_SWAP */
>
> /*
>  * Schedule all required I/O operations.  Do not wait for completion.
>_
>
>--
>To unsubscribe, send a message with 'unsubscribe linux-mm' in
>the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
>see: http://www.linux-mm.org/ .
>Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]