Skip to contentSkip to conversation

trace transparent huge page splits

RFC PATCH New Dave Hansen 1 participant 1 message Feb 1, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 trace transparent huge page splits

When we see transparent huge pages being broken down, we generally have no idea of finding anything out about how it happened, or what it affected.

A simple static tracepoint like this should at least get us some minimal information like a stack trace, the virtual address, and the mm that it happened to.

I'm not sure if there is a better way to do this with any of the other tracing mechanisms, but this seems to work at least for me. Does anybody else have a better way? Is it worth merging this kind of stuff, or is it best left out of tree as a debugging patch?

---

 linux-2.6.git-dave/include/trace/events/huge_memory.h |   32 ++++++++++++++++++
 linux-2.6.git-dave/mm/huge_memory.c                   |    5 ++
 2 files changed, 37 insertions(+)
include/trace/events/huge_memory.h new file +32 -0
diff -puN /dev/null include/trace/events/huge_memory.h
@@ -0,0 +1,32 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM huge_memory
+
+#if !defined(_TRACE_HUGE_MEMORY_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_HUGE_MEMORY_H
+
+#include <linux/types.h>
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(mm_huge_memory_split,
+
+	TP_PROTO(struct mm_struct *mm, unsigned long address),
+
+	TP_ARGS(mm, address),
+
+	TP_STRUCT__entry(
+		__field(struct mm_struct *, mm)
+		__field(unsigned long,	    address)
+	),
+
+	TP_fast_assign(
+		__entry->mm	 = mm;
+		__entry->address = address;
+	),
+
+	TP_printk("mm=%p address=%p", __entry->mm, (void *)__entry->address)
+);
+
+#endif /* _TRACE_HUGE_MEMORY_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>

diff -puN include/linux/huge_mm.h~huge_mem_trace include/linux/huge_mm.h

mm/huge_memory.c renamed from mm/huge_memory.c~huge_mem_trace +5 -0
diff -puN mm/huge_memory.c~huge_mem_trace mm/huge_memory.c
@@ -21,6 +21,9 @@
 #include <asm/pgalloc.h>
 #include "internal.h"
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/huge_memory.h>
+
 /*
  * By default transparent hugepage support is enabled for all mappings
  * and khugepaged scans all mappings. Defrag is only invoked by
@@ -1254,6 +1257,8 @@ static int __split_huge_page_map(struct 
 	pgtable_t pgtable;
 	unsigned long haddr;
 
+	trace_mm_huge_memory_split(vma->vm_mm, address);
+
 	spin_lock(&mm->page_table_lock);
 	pmd = page_check_address_pmd(page, mm, address,
 				     PAGE_CHECK_ADDRESS_PMD_SPLITTING_FLAG);

diff -puN mm/vmscan.c~huge_mem_trace mm/vmscan.c diff -puN mm/page_io.c~huge_mem_trace mm/page_io.c diff -puN block/blk-core.c~huge_mem_trace block/blk-core.c _

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>