[PATCH] kdumpctl: Add the command "kdumpctl showmem" to show the reserved memory

Vivek Goyal vgoyal at redhat.com
Mon Sep 22 15:13:09 UTC 2014


On Mon, Sep 22, 2014 at 11:24:52AM +0800, Minfei Huang wrote:
> If the grub kernel commandline is set to crashkernel=auto, it will not
> expand the crashkernel=auto in the /proc/cmdline. It still says
> crashkernel=auto.
> 
> Using /sys to determines crashkernel actual size is confusing since
> there is no unit of measure.
> 
> Add a new command "kdumpctl showmem" to show the reserved memory kindly.
> 
> Signed-off-by: Minfei Huang <mhuang at redhat.com>

Looks good to me. 

Acked-by: Vivek Goyal <vgoyal at redhat.com>

Vivek

> ---
>  kdumpctl | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/kdumpctl b/kdumpctl
> index 70d30fa..6f27669 100755
> --- a/kdumpctl
> +++ b/kdumpctl
> @@ -526,6 +526,17 @@ propagate_ssh_key()
>  	fi
>  }
>  
> +show_reserved_mem()
> +{
> +	MEM_RESERVED=$(cat /sys/kernel/kexec_crash_size)
> +	if [ $MEM_RESERVED -eq 0 ]
> +	then
> +		echo "No memory reserved for crash kernel."
> +		return
> +	fi
> +	echo "The kdump service reserved memory is `expr $MEM_RESERVED / 1024 / 1024`MB"
> +}
> +
>  is_fadump_capable()
>  {
>  	# Check if firmware-assisted dump is enabled
> @@ -899,8 +910,11 @@ main ()
>  	  propagate)
>  		propagate_ssh_key
>  		;;
> +	  showmem)
> +		show_reserved_mem
> +		;;
>  	  *)
> -		echo $"Usage: $0 {start|stop|status|restart|propagate}"
> +		echo $"Usage: $0 {start|stop|status|restart|propagate|showmem}"
>  		exit 1
>  	esac
>  }
> -- 
> 1.8.3.1
> 
> _______________________________________________
> kexec mailing list
> kexec at lists.fedoraproject.org
> https://lists.fedoraproject.org/mailman/listinfo/kexec


More information about the kexec mailing list