Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752916AbbBLWRL (ORCPT ); Thu, 12 Feb 2015 17:17:11 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:26039 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752657AbbBLWRI (ORCPT ); Thu, 12 Feb 2015 17:17:08 -0500 X-AuditID: cbfec7f4-b7f126d000001e9a-ce-54dd25d0714e From: Stefan Strogin To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Stefan Strogin , Joonsoo Kim , Andrew Morton , Marek Szyprowski , Michal Nazarewicz , aneesh.kumar@linux.vnet.ibm.com, Laurent Pinchart , Dmitry Safonov , Pintu Kumar , Weijie Yang , Laura Abbott , SeongJae Park , Hui Zhu , Minchan Kim , Dyasly Sergey , Vyacheslav Tyrtov , gregory.0xf0@gmail.com, sasha.levin@oracle.com, gioh.kim@lge.com, pavel@ucw.cz, stefan.strogin@gmail.com Subject: [PATCH 4/4] mm: cma: add trace events to debug physically-contiguous memory allocations Date: Fri, 13 Feb 2015 01:15:44 +0300 Message-id: <3cf88b9b40a883673924571c26608d922f59d900.1423777850.git.s.strogin@partner.samsung.com> X-Mailer: git-send-email 2.1.0 In-reply-to: References: In-reply-to: References: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplkeLIzCtJLcpLzFFi42I5/e/4Zd0LqndDDF52m1nMWb+GzeLx63ks Fp9WPmWzeNb0hdFi2vQNrBYru5vZLLZ3zmC36Jy4hN3i8q45bBb31vxntVh75C67xYLjLawW y76+Z7e4e+oom0Xf98PsFpNnS1l8OzmH2WLxkdvMFtd29DNZXH7zn91i6owf7BYnN5xltdjQ zOUg7nG5r5fJY+esu+wesztmsnpsWtXJ5rHp0yR2j663V5g8Tsz4zeLx4NBmFo91f14xeXx8 eovF4+C7PUwefVtWMXqsWP2d3ePzJjmPro2/WAP4o7hsUlJzMstSi/TtErgyGp4sYCloEK14 tpm/gfGnQBcjJ4eEgInEnx+LmCFsMYkL99azgdhCAksZJaZ8d+5i5AKye5kkTh3tYAVJsAE1 HLswnRHEFgGydzfPZQQpYhZoY5O4dXUP2CRhgSSJfxf6wRpYBFQlFm04ygJi8wqkSlzd2c8I sU1OYsPu/2A2p4CjxM6zj5ghNjtIzH72nQmX+ARG/gWMDKsYRVNLkwuKk9JzDfWKE3OLS/PS 9ZLzczcxQqLwyw7GxcesDjEKcDAq8fC+yL0TIsSaWFZcmXuIUYKDWUmEV/0jUIg3JbGyKrUo P76oNCe1+BAjEwenVANjRkvYxcWC5o/jfqYfkzpRx7D26EKtqPYbTT9+MYqmTHPque2ekv9X dce/+enO/FktzSETzspde8HodC+AT71OnSnlnlXfgabYC9sd3kekNp3QY1f7oxWj+WuTbp2r x0EN1+gj1of9dP+pvCmoWyurUBfrvELix3KrxeqhHscT3Hk+s/OwrFJiKc5INNRiLipOBACG y29CoAIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2818 Lines: 120 Add trace events for cma_alloc() and cma_release(). Signed-off-by: Stefan Strogin --- include/trace/events/cma.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++ mm/cma.c | 7 +++++- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 include/trace/events/cma.h diff --git a/include/trace/events/cma.h b/include/trace/events/cma.h new file mode 100644 index 0000000..3fe7a56 --- /dev/null +++ b/include/trace/events/cma.h @@ -0,0 +1,57 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM cma + +#if !defined(_TRACE_CMA_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_CMA_H + +#include +#include + +TRACE_EVENT(cma_alloc, + + TP_PROTO(struct cma *cma, unsigned long pfn, int count), + + TP_ARGS(cma, pfn, count), + + TP_STRUCT__entry( + __field(unsigned long, pfn) + __field(unsigned long, count) + ), + + TP_fast_assign( + __entry->pfn = pfn; + __entry->count = count; + ), + + TP_printk("pfn=%lu page=%p count=%lu\n", + __entry->pfn, + pfn_to_page(__entry->pfn), + __entry->count) +); + +TRACE_EVENT(cma_release, + + TP_PROTO(struct cma *cma, unsigned long pfn, int count), + + TP_ARGS(cma, pfn, count), + + TP_STRUCT__entry( + __field(unsigned long, pfn) + __field(unsigned long, count) + ), + + TP_fast_assign( + __entry->pfn = pfn; + __entry->count = count; + ), + + TP_printk("pfn=%lu page=%p count=%lu\n", + __entry->pfn, + pfn_to_page(__entry->pfn), + __entry->count) +); + +#endif /* _TRACE_CMA_H */ + +/* This part must be outside protection */ +#include diff --git a/mm/cma.c b/mm/cma.c index c68d383..a7bd7f0 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -23,6 +23,7 @@ # define DEBUG #endif #endif +#define CREATE_TRACE_POINTS #include #include @@ -37,6 +38,7 @@ #include #include #include +#include #include "cma.h" @@ -443,8 +445,10 @@ struct page *cma_alloc(struct cma *cma, int count, unsigned int align) start = bitmap_no + mask + 1; } - if (page) + if (page) { cma_buffer_list_add(cma, pfn, count); + trace_cma_alloc(cma, pfn, count); + } pr_debug("%s(): returned %p\n", __func__, page); return page; @@ -478,6 +482,7 @@ bool cma_release(struct cma *cma, struct page *pages, int count) free_contig_range(pfn, count); cma_clear_bitmap(cma, pfn, count); + trace_cma_release(cma, pfn, count); cma_buffer_list_del(cma, pfn, count); return true; -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/