On Wed, Sep 02, 2015 at 10:48:39AM +0200, Michael Holzheu wrote: > On Wed, 2 Sep 2015 10:07:21 +0900 > Simon Horman <horms at verge.net.au> wrote: > [snip] > > > 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 > > > > > > Therefore use mmap() for non-character devices to reduce the memory > > > consumption of the kexec tool. > > > > I'm not opposed to this change but I also don't see a strong motivation for > > it. I would imagine that the memory saving is not that large. And that the > > memory consumption disappears when the presumably short-lived kexec process > > exits. > > Correct it will disappear. > > The reason for the the patch is that we have the following scanario: > > 1) Boot a 4 GB Linux system > 2) Read kernel and 1,5 GB ramdisk from external source into local tmpfs (ram) > 3) kexec the kernel and ramdisk > > So without the mmap patch for the kexec runtime we need: > > 1,5 GB (tmpfs) + 1,5 GB (kexec malloc) + 1,5 GB (kernel memory) = 4,5 GB > > If we use mmap we only need 3 GB memory. Thanks, I am convinced. Could you repost the patch as a non-RFC?