[PATCH v3] kexec/s390x: use mmap instead of read for slurp_file()
Simon Horman
horms at verge.net.au
Sun Nov 8 17:59:15 PST 2015
On Fri, Oct 30, 2015 at 04:02:04PM +0100, Michael Holzheu wrote:
> The slurp_fd() function allocates memory and uses the read() system call.
> This results in double memory consumption for image and initrd:
>
> 1) Memory allocated in user space by the kexec tool
> 2) Memory allocated in kernel by the kexec() system call
>
> The following illustrates the use case that we have on s390x:
>
> 1) Boot a 4 GB Linux system
> 2) Copy kernel and 1,5 GB ramdisk from external source into tmpfs (ram)
> 3) Use kexec to boot kernel with ramdisk
>
> Therefore for kexec runtime we need:
>
> 1,5 GB (tmpfs) + 1,5 GB (kexec malloc) + 1,5 GB (kernel memory) = 4,5 GB
>
> This patch introduces slurp_file_mmap() which for "normal" files uses
> mmap() instead of malloc()/read(). This reduces the runtime memory
> consumption of the kexec tool as follows:
>
> 1,5 GB (tmpfs) + 1,5 GB (kernel memory) = 3 GB
>
> Signed-off-by: Michael Holzheu <holzheu at linux.vnet.ibm.com>
> Reviewed-by: Dave Young <dyoung at redhat.com>
Thanks, applied.
More information about the kexec
mailing list