From 99e8ea6cd2210cf2271f922384b483cd83f0f8f3 Mon Sep 17 00:00:00 2001 From: Stefan Strogin Date: Wed, 15 Apr 2015 16:14:50 -0700 Subject: mm: cma: add trace events for CMA allocations and freeings Add trace events for cma_alloc() and cma_release(). The cma_alloc tracepoint is used both for successful and failed allocations, in case of allocation failure pfn=-1UL is stored and printed. Signed-off-by: Stefan Strogin Cc: Ingo Molnar Cc: Steven Rostedt Cc: Joonsoo Kim Cc: Michal Nazarewicz Cc: Marek Szyprowski Cc: Laurent Pinchart Cc: Thierry Reding Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/cma.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'mm/cma.c') diff --git a/mm/cma.c b/mm/cma.c index 47203faaf65e..3a7a67b93394 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -23,6 +23,7 @@ # define DEBUG #endif #endif +#define CREATE_TRACE_POINTS #include #include @@ -34,6 +35,7 @@ #include #include #include +#include #include "cma.h" @@ -414,6 +416,8 @@ struct page *cma_alloc(struct cma *cma, unsigned int count, unsigned int align) start = bitmap_no + mask + 1; } + trace_cma_alloc(page ? pfn : -1UL, page, count, align); + pr_debug("%s(): returned %p\n", __func__, page); return page; } @@ -446,6 +450,7 @@ bool cma_release(struct cma *cma, const struct page *pages, unsigned int count) free_contig_range(pfn, count); cma_clear_bitmap(cma, pfn, count); + trace_cma_release(pfn, pages, count); return true; } -- cgit v1.2.3-59-g8ed1b