[PATCH] makedumpfile: turn off mmap for free page scan

Atsushi Kumagai kumagai-atsushi at mxc.nes.nec.co.jp
Wed May 22 02:57:12 EDT 2013


On Wed, 15 May 2013 13:43:59 -0500
Cliff Wickman <cpw at sgi.com> wrote:

> From: Cliff Wickman <cpw at sgi.com>
> 
> Because addresses of each successive page structure are often descending
> it is much faster to use read()'s, so set off info->flag_usemmap
> while doing exclude_free_page().
> 
> Signed-off-by: Cliff Wickman <cpw at sgi.com>

Sounds good.
BTW, do you have a speed measurement like your another patch ?

> I find this to speed the scan of page structures for a 1TB system from
> 60sec to 30sec.


Thanks
Atsushi Kumagai

> ---
>  makedumpfile.c |   15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> Index: makedumpfile.mmap/makedumpfile.c
> ===================================================================
> --- makedumpfile.mmap.orig/makedumpfile.c
> +++ makedumpfile.mmap/makedumpfile.c
> @@ -3925,9 +3925,18 @@ _exclude_free_page(void)
>  	return TRUE;
>  }
>  
> +/*
> + * Note that this is a very lengthy process, even using mmap(2). The
> + * page structures in the free lists are read one-at-a-time, but using
> + * readpage_elf(), which reads an entire page.  And addresses of each
> + * successive page structure are often descending, which means that each
> + * read is another mmap(2) operation.
> + * It is much faster to use read()'s, so set off info->flag_usemmap here.
> + */
>  int
>  exclude_free_page(void)
>  {
> +	int save = info->flag_usemmap;
>  	/*
>  	 * Check having necessary information.
>  	 */
> @@ -3961,8 +3970,12 @@ exclude_free_page(void)
>  	/*
>  	 * Detect free pages and update 2nd-bitmap.
>  	 */
> -	if (!_exclude_free_page())
> +	info->flag_usemmap = 0;
> +	if (!_exclude_free_page()) {
> +		info->flag_usemmap = save;
>  		return FALSE;
> +	}
> +	info->flag_usemmap = save;
>  
>  	return TRUE;
>  }



More information about the kexec mailing list