On 07/25/13 at 09:39am, Vivek Goyal wrote:
On Thu, Jul 25, 2013 at 02:21:14PM +0800, WANG Chao wrote:
> 2nd kernel has very limited memory. Allocating huge pages will probably
> trigger OOM. So let's remove hugepages and hugepagesz kernel parameters
> for 2nd kernel when 1st kernel are using them.
>
> If user wants huge pages cmdline in 2nd kernel, he/she can still specify
> it through KERNEL_COMMANDLINE_APPEND in /etc/sysconfig/kdump.
>
> This patch adds a new function remove_cmdline(). It takes a list of
> kernel parameters as its arguments and remove them from
> 1st kernel cmdline or KERNEL_COMMANDLINE if set in /etc/sysconfig/kdump.
> However It wouldn't touch user specified KDUMP_COMMANDLINE_APPEND in
> /etc/sysconfig/kdump.
>
> Signed-off-by: WANG Chao <chaowang(a)redhat.com>
> ---
> kdumpctl | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/kdumpctl b/kdumpctl
> index 36e969f..8aaeb97 100755
> --- a/kdumpctl
> +++ b/kdumpctl
> @@ -16,6 +16,16 @@ if [ -f /etc/sysconfig/kdump ]; then
> . /etc/sysconfig/kdump
> fi
>
> +function remove_cmdline()
> +{
Can you please put a function description comment above and explain
what this function is doing. What arguments does it expect etc.
Sure, will do.
Also I think it is better to call it remove_cmdline_param()
Yeah, that's better.
Thanks for the review.
Thanks
Vivek
> + for arg in $@; do
> + KDUMP_COMMANDLINE=`echo $KDUMP_COMMANDLINE | \
> + sed -e "s/\b$arg=[^ ]*\b//g" \
> + -e "s/\b$arg\b//g" \
> + -e "s/\s\+/ /g"`
> + done
> +}
> +
> function save_core()
> {
> coredir="/var/crash/`date +"%Y-%m-%d-%H:%M"`"
> @@ -221,8 +231,8 @@ function load_kdump()
> then
> KDUMP_COMMANDLINE=`cat /proc/cmdline`
> fi
> + remove_cmdline crashkernel hugepages hugepagesz
>
> - KDUMP_COMMANDLINE=`echo $KDUMP_COMMANDLINE | sed -e 's/crashkernel=[^
]*//'`
Now we should be able to use remove_cmdline_param() to remove crashkernel=
option too?
Thanks
Vivek
> KDUMP_COMMANDLINE="${KDUMP_COMMANDLINE} ${KDUMP_COMMANDLINE_APPEND}"
>
> $KEXEC $KEXEC_ARGS $standard_kexec_args \
> --
> 1.8.3.1
>
> _______________________________________________
> kexec mailing list
> kexec(a)lists.fedoraproject.org
>
https://lists.fedoraproject.org/mailman/listinfo/kexec