public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] makedumpfile: turn off mmap for free page scan
@ 2013-05-15 18:43 Cliff Wickman
  2013-05-22  6:57 ` Atsushi Kumagai
  0 siblings, 1 reply; 3+ messages in thread
From: Cliff Wickman @ 2013-05-15 18:43 UTC (permalink / raw)
  To: kexec; +Cc: d.hatayama, kumagai-atsushi

From: Cliff Wickman <cpw@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@sgi.com>
---
 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;
 }

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] makedumpfile: turn off mmap for free page scan
  2013-05-15 18:43 [PATCH] makedumpfile: turn off mmap for free page scan Cliff Wickman
@ 2013-05-22  6:57 ` Atsushi Kumagai
  2013-05-22  7:38   ` HATAYAMA Daisuke
  0 siblings, 1 reply; 3+ messages in thread
From: Atsushi Kumagai @ 2013-05-22  6:57 UTC (permalink / raw)
  To: cpw; +Cc: d.hatayama, kexec

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

> From: Cliff Wickman <cpw@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@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;
>  }

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] makedumpfile: turn off mmap for free page scan
  2013-05-22  6:57 ` Atsushi Kumagai
@ 2013-05-22  7:38   ` HATAYAMA Daisuke
  0 siblings, 0 replies; 3+ messages in thread
From: HATAYAMA Daisuke @ 2013-05-22  7:38 UTC (permalink / raw)
  To: cpw; +Cc: kexec, Atsushi Kumagai

(2013/05/22 15:57), Atsushi Kumagai wrote:
> On Wed, 15 May 2013 13:43:59 -0500
> Cliff Wickman <cpw@sgi.com> wrote:
>
>> From: Cliff Wickman <cpw@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@sgi.com>
>
> Sounds good.
> BTW, do you have a speed measurement like your another patch ?
>

Also how about keeping mmap mode and reducing mapping size temporarily 
to 4KiB?

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

I don't know which this measured time indicates. Only free pages 
filtering or free pages filtering plus unnecessary pages filtering?

-- 
Thanks.
HATAYAMA, Daisuke


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-22  7:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-15 18:43 [PATCH] makedumpfile: turn off mmap for free page scan Cliff Wickman
2013-05-22  6:57 ` Atsushi Kumagai
2013-05-22  7:38   ` HATAYAMA Daisuke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox