linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/cma: Make kmemleak ignore CMA regions
@ 2014-10-21 12:14 Thierry Reding
  2014-10-23 20:22 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Thierry Reding @ 2014-10-21 12:14 UTC (permalink / raw)
  To: Andrew Morton, Marek Szyprowski; +Cc: linux-mm, linux-kernel

From: Thierry Reding <treding@nvidia.com>

kmemleak will add allocations as objects to a pool. The memory allocated
for each object in this pool is periodically searched for pointers to
other allocated objects. This only works for memory that is mapped into
the kernel's virtual address space, which happens not to be the case for
most CMA regions.

Furthermore, CMA regions are typically used to store data transferred to
or from a device and therefore don't contain pointers to other objects.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
Note: I'm not sure this is really the right fix. But without this, the
kernel crashes on the first execution of the scan_gray_list() because
it tries to access highmem. Perhaps a more appropriate fix would be to
reject any object that can't map to a kernel virtual address?
---
 mm/cma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/cma.c b/mm/cma.c
index 963bc4add9af..349f9266f6d3 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -280,6 +280,7 @@ int __init cma_declare_contiguous(phys_addr_t base,
 			ret = -ENOMEM;
 			goto err;
 		} else {
+			kmemleak_ignore(phys_to_virt(addr));
 			base = addr;
 		}
 	}
-- 
2.1.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2014-10-23 21:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-21 12:14 [PATCH] mm/cma: Make kmemleak ignore CMA regions Thierry Reding
2014-10-23 20:22 ` Andrew Morton
2014-10-23 21:09   ` Catalin Marinas

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).