Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753545AbbBXSpF (ORCPT ); Tue, 24 Feb 2015 13:45:05 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:55131 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753160AbbBXSo7 (ORCPT ); Tue, 24 Feb 2015 13:44:59 -0500 X-AuditID: cbfec7f4-b7f126d000001e9a-a3-54ecc6183458 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 , Aleksei Mateosian , gregory.0xf0@gmail.com, sasha.levin@oracle.com, gioh.kim@lge.com, pavel@ucw.cz, stefan.strogin@gmail.com Subject: [PATCH v3 1/4] mm: cma: add trace events to debug physically-contiguous memory allocations Date: Tue, 24 Feb 2015 21:44:32 +0300 Message-id: <9ae4c45b49e8df6e079448550c2b81ade5d3603a.1424802755.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+NgFprCIsWRmVeSWpSXmKPExsVy+t/xa7oSx96EGHz/Km3xcN4kdos569ew WTx+PY/F4tPKp2wWz5q+MFpMm76B1WJldzObxfbOGewWnROXsFtc3jWHzeLemv+sFmuP3GW3 WHC8hdVi2df37BZ3Tx1ls+j7fpjdYvJsKYtvJ+cwWyw+cpvZ4tqOfiaLy2/+s1tMnfGD3eLk hrOsFhuauRwkPC739TJ57Jx1l91jdsdMVo9NqzrZPDZ9msTu0fX2CpPHiRm/WTweHNrM4rHu zysmj49Pb7F4HHy3h8mjb8sqRo8Vq7+ze3zeJOfRtfEXawB/FJdNSmpOZllqkb5dAlfG3pW3 mAp6RSpmTX/H1MA4Q6CLkZNDQsBE4siUe6wQtpjEhXvr2boYuTiEBJYySix6ewnK6WWSmL53 GztIFRtQx7EL0xlBbBEge3fzXEaQImaBrWwSDSd/sIAkhAVSJb42NIM1sAioSqx5eYUZxOYF in/o+88EsU5OYsPu/2CDOAUcJXpOvAazhQQcJN7sv8KCS3wCI/8CRoZVjKKppckFxUnpuYZ6 xYm5xaV56XrJ+bmbGCEx+WUH4+JjVocYBTgYlXh4H5S9ChFiTSwrrsw9xCjBwawkwrth85sQ Id6UxMqq1KL8+KLSnNTiQ4xMHJxSDYwTZ7bMU1tqN3XCx9YluyIKddjirl65Mk9Xa/r6kian rRap4bXbbtxNY93z7b9Hbbl/zcWYEnd/s9yVfMV7tDmbXDb5+54M53jVGPbKV8bVVMBQreC4 RUnxiiuuUj/NTn3TUj7gtXeit3F61Ve5rqcWGufXc28x3q7WOn1djXKMA+ff/7uZjyqxFGck GmoxFxUnAgBgR5o4pwIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2705 Lines: 118 Add trace events for cma_alloc() and cma_release(). Signed-off-by: Stefan Strogin --- include/trace/events/cma.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++ mm/cma.c | 6 +++++ 2 files changed, 63 insertions(+) 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 9e3d44a..3a63c96 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" @@ -408,6 +410,9 @@ struct page *cma_alloc(struct cma *cma, int count, unsigned int align) start = bitmap_no + mask + 1; } + if (page) + trace_cma_alloc(cma, pfn, count); + pr_debug("%s(): returned %p\n", __func__, page); return page; } @@ -440,6 +445,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); 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/