[PATCH] makedumpfile: use non-cyclic when possible

Cliff Wickman cpw at sgi.com
Wed Aug 28 18:08:07 EDT 2013


From: Cliff Wickman <cpw at sgi.com>

If there is plenty of memory use non-cyclic mode.

Diffed against makedumpfile-1.5.4
Signed-off-by: Cliff Wickman <cpw at sgi.com>
---
 makedumpfile.c |   26 ++++++++++++++++++++++++++

Index: makedumpfile-1.5.4/makedumpfile.c
===================================================================
--- makedumpfile-1.5.4.orig/makedumpfile.c
+++ makedumpfile-1.5.4/makedumpfile.c
@@ -7638,6 +7638,23 @@ writeout_multiple_dumpfiles(void)
 	return ret;
 }
 
+/*
+ * Plenty of memory to do a non-cyclic dump.
+ * Default to non-cyclic in this case.
+ */
+static int
+plenty_of_memory(void)
+{
+	unsigned long free_size;
+	unsigned long needed_size;
+
+	free_size = get_free_memory_size();
+	needed_size = (info->max_mapnr * 2) / BITPERBYTE;
+	if (free_size > (needed_size + (10*1024*1024)))
+		return 1;
+	return 0;
+}
+
 int
 create_dumpfile(void)
 {
@@ -7655,6 +7672,15 @@ create_dumpfile(void)
 
 	print_vtop();
 
+	if (plenty_of_memory()) {
+		if (info->flag_cyclic == TRUE)
+			MSG("Plenty of memory; using non-cyclic mode.\n");
+		info->flag_cyclic = FALSE;
+	} else {
+		if (info->flag_cyclic == TRUE)
+			MSG("Restricted memory; staying in cyclic mode.\n");
+	}
+
 	num_retry = 0;
 retry:
 	if (info->flag_refiltering) {



More information about the kexec mailing list