Re: [PATCH 1/2] mm: add cond_resched to generic_swapfile_activate

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

 



On Fri 22-07-16 17:11:20, Mikulas Patocka wrote:
> The function generic_swapfile_activate can take quite long time, it iterates
> over all blocks of a file, so add cond_resched to it. I observed about 1 second
> stalls when activating a swapfile that was almost unfragmented - this patch
> fixes it.
> 
> Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>

Acked-by: Michal Hocko <mhocko@xxxxxxxx>

> 
> ---
>  mm/page_io.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> Index: linux-4.7-rc7/mm/page_io.c
> ===================================================================
> --- linux-4.7-rc7.orig/mm/page_io.c	2016-05-30 17:34:37.000000000 +0200
> +++ linux-4.7-rc7/mm/page_io.c	2016-07-11 17:23:33.000000000 +0200
> @@ -166,6 +166,8 @@ int generic_swapfile_activate(struct swa
>  		unsigned block_in_page;
>  		sector_t first_block;
>  
> +		cond_resched();
> +
>  		first_block = bmap(inode, probe_block);
>  		if (first_block == 0)
>  			goto bad_bmap;

-- 
Michal Hocko
SUSE Labs

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