[PATCHv2] calculate cyclic buffer size according to info->num_dumpfile

Maxim Uvarov maxim.uvarov at oracle.com
Wed Jul 10 06:02:05 EDT 2013


Dump kernel work in limited memory space and makedumpfile buffers
have to fit to empty memory due to not be killed with OOM-killer.

v2: avoid divide by zero

Signed-off-by: Maxim Uvarov <maxim.uvarov at oracle.com>
---
 makedumpfile.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/makedumpfile.c b/makedumpfile.c
index b42565c..14bacb2 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -2997,6 +2997,8 @@ out:
 			 * Truncate the buffer size to free memory size.
 			 */
 			free_memory = get_free_memory_size();
+			if (info->num_dumpfile > 1)
+				free_memory /= info->num_dumpfile;
 			if (info->bufsize_cyclic > free_memory) {
 				MSG("Specified buffer size is larger than free memory.\n");
 				MSG("The buffer size for the cyclic mode will ");
@@ -8548,6 +8550,9 @@ calculate_cyclic_buffer_size(void) {
 	 */
 	free_size = get_free_memory_size() * 0.4;
 	needed_size = (info->max_mapnr * 2) / BITPERBYTE;
+	/* if --split was specified cyclic buffer allocated per dump file */
+	if (info->num_dumpfile > 1)
+		needed_size /= info->num_dumpfile;
 
 	info->bufsize_cyclic = (free_size <= needed_size) ? free_size : needed_size;
 
-- 
1.7.9.5




More information about the kexec mailing list