[PATCH 4/4] kexec-tools: Add cgroup_disable=memory to crash kernel parameters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



cgroup memory subsystem pre-allocates quite some memory at boot up.
Example dmesg:
allocated 469762048 bytes of page_cgroup
please try 'cgroup_disable=memory' option if you don't want memory cgroups

Due to maxcpu=1 it is by far not that much than in a productive kernel.
It still seem to be around 4M statically as no Numa overhead exists with
only one active CPU. It is still worth to disable cgroup memory
pre-allocating in crash kernel environment.

Signed-off-by: Thomas Renninger <trenn at suse.de>
Signed-off-by: Thomas Renninger <Thomas Renninger" trenn at suse.de>
---
 kexec/arch/i386/crashdump-x86.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index 7fd1c5b..e6d60a9 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -757,6 +757,23 @@ static int cmdline_add_elfcorehdr(char *cmdline, unsigned long addr)
 	return 0;
 }
 
+static void cmdline_disable_cgroup(char *cmdline)
+{
+	int cmdlen;
+	char str[30] = " cgroup_disable=memory";
+
+	cmdlen = strlen(cmdline) + strlen(str);
+	if (cmdlen > (COMMAND_LINE_SIZE - 1)) {
+		/* Not fatal if cgroup memory is not disabled */
+		dbgprintf(
+		  "Command line overflow, cgroup memory not disabled\n");
+		return;
+	}
+	strcat(cmdline, str);
+
+	dbgprintf("Command line after adding adding cgroup_disable=memory\n");
+	dbgprintf("%s\n", cmdline);
+}
 
 /*
  * This routine is specific to i386 architecture to maintain the
@@ -1037,6 +1054,11 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
 		end = mem_range[i].end;
 		cmdline_add_memmap_acpi(mod_cmdline, start, end);
 	}
+	/* 
+	 * Always add disabling cgroup_diable=memory param at the end,
+	 * it's not critical if it falls off
+	 */
+	cmdline_disable_cgroup(mod_cmdline);
 	return 0;
 }
 
-- 
1.7.6.1




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux