In addition to the many MM changes merged this weekend for Linux 6.17, Andrew Morton on Sunday also sent out his “non-MM” pull request for this new kernel. Notable there is improving the Kdump code to allow for crash kernel reservation made from the contiguous memory allocator to help yield less wasted RAM and greater reliability.
The patches merged for Linux 6.17 allow for the Kdump crashkernel reservation from CMA to be dynamically allocated rather than currently relying on static allocation. Jiri Bohac of SUSE explained in the patch series working on this functionality:
“Currently, all the memory for the crash kernel is not usable by the 1st (production) kernel. It is also unmapped so that it can’t be corrupted by the fault that will eventually trigger the crash. This makes sense for the memory actually used by the kexec-loaded crash kernel image and initrd and the data prepared during the load (vmcoreinfo, …). However, the reserved space needs to be much larger than that to provide enough run-time memory for the crash kernel and the kdump userspace. Estimating the amount of memory to reserve is difficult. Being too careful makes kdump likely to end in OOM, being too generous takes even more memory from the production system. Also, the reservation only allows reserving a single contiguous block (or two with the “low” suffix). I’ve seen systems where this fails because the physical memory is fragmented.
By reserving additional crashkernel memory from CMA, the main crashkernel reservation can be just large enough to fit the kernel and initrd image, minimizing the memory taken away from the production system. Most of the run-time memory for the crash kernel will be memory previously available to userspace in the production system. As this memory is no longer wasted, the reservation can be done with a generous margin, making kdump more reliable. Kernel memory that we need to preserve for dumping is normally not allocated from CMA, unless it is explicitly allocated as movable. Currently this is only the case for memory ballooning and zswap. Such movable memory will be missing from the vmcore. User data is typically not dumped by makedumpfile. When dumping of user data is intended this new CMA reservation cannot be used.”
With the non-MM updates merged for Linux 6.17, this crashkernel CMA reservation is working for Linux x86/x86_64-based kernels. This code was nearly two years in the making so it’s nice to see it cross the finish line in Linux 6.17.