Fix: kmem instrumentation: mm_page_alloc extfrag change_ownership field
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 19 Mar 2015 16:55:48 +0000 (12:55 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 19 Mar 2015 19:32:32 +0000 (15:32 -0400)
Linux kernel 3.12.30 and onward changes the parameter received by this
callback. It's the same type, but the meaning differs. This is why it
did compile fine, but the data gathered did not really represent
change_ownership.

This change has been introduced in the Linux kernel by this commit:

commit 52c8f6a5aeb0bdd396849ecaa72d96f8175528f5
Author: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Date:   Tue Nov 12 15:08:19 2013 -0800

    mm: get rid of unnecessary overhead of trace_mm_page_alloc_extfrag()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
instrumentation/events/lttng-module/kmem.h

index 2bc70a8d3db5136b48ab954b98b36ca01e765725..985d3065882afc88017b65e64466417f4d6c8ab7 100644 (file)
@@ -286,7 +286,49 @@ DEFINE_EVENT_PRINT(mm_page, mm_page_pcpu_drain,
                __entry->order, __entry->migratetype)
 )
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,30))
+
+LTTNG_TRACEPOINT_EVENT(mm_page_alloc_extfrag,
+
+       TP_PROTO(struct page *page,
+               int alloc_order, int fallback_order,
+               int alloc_migratetype, int fallback_migratetype, int new_migratetype),
+
+       TP_ARGS(page,
+               alloc_order, fallback_order,
+               alloc_migratetype, fallback_migratetype, new_migratetype),
+
+       TP_STRUCT__entry(
+               __field_hex(    struct page *,  page                    )
+               __field(        int,            alloc_order             )
+               __field(        int,            fallback_order          )
+               __field(        int,            alloc_migratetype       )
+               __field(        int,            fallback_migratetype    )
+               __field(        int,            change_ownership        )
+       ),
+
+       TP_fast_assign(
+               tp_assign(page, page)
+               tp_assign(alloc_order, alloc_order)
+               tp_assign(fallback_order, fallback_order)
+               tp_assign(alloc_migratetype, alloc_migratetype)
+               tp_assign(fallback_migratetype, fallback_migratetype)
+               tp_assign(change_ownership, (new_migratetype == alloc_migratetype))
+       ),
+
+       TP_printk("page=%p pfn=%lu alloc_order=%d fallback_order=%d pageblock_order=%d alloc_migratetype=%d fallback_migratetype=%d fragmenting=%d change_ownership=%d",
+               __entry->page,
+               page_to_pfn(__entry->page),
+               __entry->alloc_order,
+               __entry->fallback_order,
+               pageblock_order,
+               __entry->alloc_migratetype,
+               __entry->fallback_migratetype,
+               __entry->fallback_order < pageblock_order,
+               __entry->change_ownership)
+)
+
+#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
 
 TRACE_EVENT(mm_page_alloc_extfrag,
 
This page took 0.027502 seconds and 4 git commands to generate.