FROMGIT: mm/cma.c: delete kmemleak objects when freeing CMA areas to buddy at boot
Since every CMA region is now tracked by kmemleak at the time cma_activate_area() is invoked, and cma_activate_area() is called for each CMA region, invoke kmemleak_free_part_phys() during cma_activate_area() to inform kmemleak that the CMA region will be freed. Doing so also removes the need to invoke kmemleak_ignore_phys() when the global CMA region is being created, as the kmemleak object for it will be deleted. This helps resolve a crash when kmemleak and CONFIG_DEBUG_PAGEALLOC are both enabled, since CONFIG_DEBUG_PAGEALLOC causes the CMA region to be unmapped from the kernel's address space when the pages are freed to buddy. Without this patch, kmemleak will attempt to scan the CMA regions, even though they are unmapped, which leads to a page-fault. Link: https://lkml.kernel.org/r/20230109221624.592315-3-isaacmanjarres@google.com Signed-off-by:Isaac J. Manjarres <isaacmanjarres@google.com> Cc: Isaac J. Manjarres <isaacmanjarres@google.com> Cc: Saravana Kannan <saravanak@google.com> Cc: Suren Baghdasaryan <surenb@google.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: <stable@vger.kernel.org> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Bug: 265065728 (cherry picked from commit 7612fee153e571473ad266ae9109b7a2fea35f56 git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable) Change-Id: Ifd0ed91d9381ca38b5d9200d52a71e356544596e Signed-off-by:
Isaac J. Manjarres <isaacmanjarres@google.com>
Loading