Ronit halder <ronit.crj(a)gmail.com> writes:
Currently, linux kernel allocates memory at the boot time for crash
kernel booted using kexec system call in kernel crash. It will be very
useful if we can allocate memory in run time. The user can get more
usable RAM if we can do that.
It is possible to allocate memory for crash kernel at the boot time
using CMA (Contiguous Memory Allocator). CMA is capable of allocating
big chunk of memory. At the boot time we will create one (if only low
memory is used) or two (if we use both high and low memory) CMA areas
of size given in "crashkernel" boot time command line parameter. This
memory in CMA areas can be used by movable pages (used for disk caches,
process pages, etc) if not allocated. Then the user can allocate or
free memory from those CMA areas using "/sys/kernel/kexec_crash_size"
sysfs entry. If the user uses high memory kernel will automatically at
least 256MB low memory when the user allocates memory using mentioned
sysfs enrty. In case of high memory allocation the user controls the
size of reserved region in high memory with
"/sys/kernel/kexec_crash_size" entry. If the size set is zero then the
memory allocated in low memory will automatically be freed.
I am attaching a prototype patch with the mail. Please share your
opinions on my approach. This patch is only for x86 and x86_64.
Please note, this patch is only a prototype just to explain my approach
and get the review.
Signed-off-by: Ronit Halder <ronit.crj(a)gmail.com>
So basically no.
The reason for allocating memory at boot time is to guarantee that the
kernel never uses that memory for anything and thus cannont get confused
and use a stale DMA address and DMA onto that memory. Also since the
memory has always been reserved the memory is likely not adjacent to
any address used for DMA either.
Nothing you have said even addresses the reason for allocating memory
the way we do. If we wanted efficiency we would allocating the memory
a page at a time the way kexec does.
So I don't see anything that even tempts me to evaluate this patch.
Eric