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

Cliff Wickman cpw at sgi.com
Wed May 15 14:43:59 EDT 2013


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