vmcore-dmesg: avoid allocating large memory chunk for log buf

In kdump kernel, we got:

    Saving vmcore-dmesg.txt
    Failed to malloc 67108864 bytes for the logbuf: Cannot allocate memory

Apparently 64M is too luxury for a kdump kernel which only has 128M
in total.

We can avoid allocating such a large memory chunk, instead just allocate
a smaller chunk inside the loop each time.

Verify the result by comparing the vmcore-dmesg output with and without
this patch.

Cc: Simon Horman <horms@verge.net.au>
Reviewed-by: Dave Young <dyoung@redhat.com>
Reviewed-by: Pratyush Anand <panand@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
1 file changed