linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/2] Fixes for kmemleak tracking with CMA regions
@ 2023-01-09 22:16 Isaac J. Manjarres
  2023-01-09 22:16 ` [PATCH v1 1/2] mm/cma.c: Make kmemleak aware of all " Isaac J. Manjarres
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Isaac J. Manjarres @ 2023-01-09 22:16 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Saravana Kannan, Suren Baghdasaryan, Isaac J. Manjarres,
	kernel-team, linux-mm, linux-kernel

When trying to boot a device with an ARM64 kernel with the following
config options enabled:

CONFIG_DEBUG_PAGEALLOC=y
CONFIG_DEBUG_PAGEALLOC_ENABLE_DEFAULT=y
CONFIG_DEBUG_KMEMLEAK=y

a page-fault is encountered when kmemleak starts to scan the list of gray
or allocated objects that it maintains. Upon closer inspection, it was
observed that these page-faults always occurred when kmemleak attempted
to scan a CMA region.

At the moment, kmemleak is made aware of CMA regions that are specified
through the devicetree to be created at specific memory addresses or
dynamically allocated within a range of addresses. However, if the
CMA region is constrained to a certain range of addresses through the
command line, the region is reserved through the memblock_reserve()
function, but kmemleak_alloc_phys() is not invoked. Furthermore,
kmemleak is never informed about CMA regions being freed to buddy at
boot, which is problematic when CONFIG_DEBUG_PAGEALLOC is enabled, as
all CMA regions are unmapped from the kernel's address space, and
subsequently causes a page-fault when kmemleak attempts to scan any
of them.

This series makes it so that kmemleak is aware of every CMA region before
they are freed to the buddy allocator, so that at that time, kmemleak
can be informed that each region is about to be freed, and thus it
should not attempt to scan those regions.

Isaac J. Manjarres (2):
  mm/cma.c: Make kmemleak aware of all CMA regions
  mm/cma.c: Delete kmemleak objects when freeing CMA areas to buddy at
    boot

 mm/cma.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

-- 
2.39.0.314.g84b9a713c41-goog



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-01-27  2:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-09 22:16 [PATCH v1 0/2] Fixes for kmemleak tracking with CMA regions Isaac J. Manjarres
2023-01-09 22:16 ` [PATCH v1 1/2] mm/cma.c: Make kmemleak aware of all " Isaac J. Manjarres
2023-01-09 22:16 ` [PATCH v1 2/2] mm/cma.c: Delete kmemleak objects when freeing CMA areas to buddy at boot Isaac J. Manjarres
2023-01-18 17:16 ` [PATCH v1 0/2] Fixes for kmemleak tracking with CMA regions Catalin Marinas
2023-01-20  0:20   ` Isaac Manjarres
2023-01-24 15:48     ` Catalin Marinas
2023-01-24 20:20       ` Andrew Morton
2023-01-24 21:23         ` Isaac Manjarres
2023-01-24 21:19       ` Isaac Manjarres
2023-01-25 12:08         ` Catalin Marinas
2023-01-27  2:39           ` Isaac Manjarres

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).