public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] makedumpfile: use non-cyclic when possible
@ 2013-08-28 22:08 Cliff Wickman
  2013-08-30  0:39 ` HATAYAMA Daisuke
  0 siblings, 1 reply; 3+ messages in thread
From: Cliff Wickman @ 2013-08-28 22:08 UTC (permalink / raw)
  To: d.hatayama, kumagai-atsushi; +Cc: kexec

From: Cliff Wickman <cpw@sgi.com>

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

Diffed against makedumpfile-1.5.4
Signed-off-by: Cliff Wickman <cpw@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) {

_______________________________________________
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-09-09  7:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-28 22:08 [PATCH] makedumpfile: use non-cyclic when possible Cliff Wickman
2013-08-30  0:39 ` HATAYAMA Daisuke
2013-09-09  7:55   ` Atsushi Kumagai

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