On 21.05.25 12:30, Baoquan He wrote:
On 05/21/25 at 03:47pm, Zhongkun He wrote:
On Wed, May 14, 2025 at 2:40 AM Alexander Graf <g...@amazon.com> wrote:
......
/**
* kexec_locate_mem_hole - find free memory for the purgatory or the next
kernel
* @kbuf: Parameters for the memory search.
@@ -648,6 +684,13 @@ int kexec_locate_mem_hole(struct kexec_buf *kbuf)
if (kbuf->mem != KEXEC_BUF_MEM_UNKNOWN)
return 0;
+ /*
+ * Try to find a free physically contiguous block of memory first. With
that, we
+ * can avoid any copying at kexec time.
+ */
+ if (!kexec_alloc_contig(kbuf))
+ return 0;
IIUC, The kexec_locate_mem_hole() function is also used in
the KEXEC_TYPE_CRASH kimage, but kexec_alloc_contig() does not skip it.
This can cause kdump to fail and lead to CMA memory leakage.
That is true and good catch, and fix is needed to skip cma alloc for
kdump.
Thanks for catching this! I added a check to ensure we don't use the CMA
logic with crash kernels in v4 and posted it.
Alex
Amazon Web Services Development Center Germany GmbH
Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597