[PATCH] makedumpfile: show needed memory
Cliff Wickman
cpw at sgi.com
Wed Aug 28 18:08:07 EDT 2013
From: Cliff Wickman <cpw at sgi.com>
If there is not enough memory available to run in cyclic mode display
how much more would be needed to do so.
Diffed against makedumpfile-1.5.4
Signed-off-by: Cliff Wickman <cpw at sgi.com>
---
makedumpfile.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Index: makedumpfile-1.5.4/makedumpfile.c
===================================================================
--- makedumpfile-1.5.4.orig/makedumpfile.c
+++ makedumpfile-1.5.4/makedumpfile.c
@@ -7778,11 +7778,15 @@ plenty_of_memory(void)
{
unsigned long free_size;
unsigned long needed_size;
+ long slack = 10; /* 10M extra */
+ long meg = 1024*1024;
free_size = get_free_memory_size();
- needed_size = (info->max_mapnr * 2) / BITPERBYTE;
- if (free_size > (needed_size + (10*1024*1024)))
+ needed_size = ((info->max_mapnr * 2) / BITPERBYTE) + (slack * meg);
+ if (free_size > needed_size)
return 1;
+ PROGRESS_MSG("Need %ldM more memory to use noncyclic mode.\n",
+ (needed_size - free_size)/meg);
return 0;
}
More information about the kexec
mailing list