linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add trace event for munmap
@ 2010-07-08 14:05 Eric B Munson
  2010-07-08 14:15 ` Rik van Riel
  2010-07-08 14:22 ` Peter Zijlstra
  0 siblings, 2 replies; 7+ messages in thread
From: Eric B Munson @ 2010-07-08 14:05 UTC (permalink / raw)
  To: akpm
  Cc: mingo, hugh.dickins, riel, linux-kernel, linux-mm, peterz, anton,
	Eric B Munson

This patch adds a trace event for munmap which will record the starting
address of the unmapped area and the length of the umapped area.  This
event will be used for modeling memory usage.

Signed-of-by: Eric B Munson <emunson@mgebm.net>
---
 include/trace/events/mm.h |   30 ++++++++++++++++++++++++++++++
 mm/mmap.c                 |    5 +++++
 2 files changed, 35 insertions(+), 0 deletions(-)
 create mode 100644 include/trace/events/mm.h

diff --git a/include/trace/events/mm.h b/include/trace/events/mm.h
new file mode 100644
index 0000000..c3a3857
--- /dev/null
+++ b/include/trace/events/mm.h
@@ -0,0 +1,30 @@
+#if !defined(_TRACE_MM_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_MM_H_
+
+#include <linux/tracepoint.h>
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM mm
+
+TRACE_EVENT(munmap,
+	TP_PROTO(unsigned long start, size_t len),
+
+	TP_ARGS(start, len),
+
+	TP_STRUCT__entry(
+		__field(unsigned long, start)
+		__field(size_t, len)
+	),
+
+	TP_fast_assign(
+		__entry->start = start;
+		__entry->len = len;
+	),
+
+	TP_printk("unmapping %u bytes at %lu\n", __entry->len, __entry->start)
+);
+
+#endif /* _TRACE_MM_H_ */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
diff --git a/mm/mmap.c b/mm/mmap.c
index 456ec6f..0775a30 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -29,6 +29,9 @@
 #include <linux/mmu_notifier.h>
 #include <linux/perf_event.h>
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/mm.h>
+
 #include <asm/uaccess.h>
 #include <asm/cacheflush.h>
 #include <asm/tlb.h>
@@ -2079,6 +2082,8 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len)
 		}
 	}
 
+	trace_munmap(start, len);
+
 	/*
 	 * Remove the vma's, and unmap the actual pages
 	 */
-- 
1.7.0.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add trace event for munmap
  2010-07-08 14:05 [PATCH] Add trace event for munmap Eric B Munson
@ 2010-07-08 14:15 ` Rik van Riel
  2010-07-08 14:22 ` Peter Zijlstra
  1 sibling, 0 replies; 7+ messages in thread
From: Rik van Riel @ 2010-07-08 14:15 UTC (permalink / raw)
  To: Eric B Munson
  Cc: akpm, mingo, hugh.dickins, linux-kernel, linux-mm, peterz, anton

On 07/08/2010 10:05 AM, Eric B Munson wrote:
> This patch adds a trace event for munmap which will record the starting
> address of the unmapped area and the length of the umapped area.  This
> event will be used for modeling memory usage.

Sounds like a useful trace point to me.

> Signed-of-by: Eric B Munson<emunson@mgebm.net>

Reviewed-by: Rik van Riel <riel@redhat.com>

-- 
All rights reversed

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add trace event for munmap
  2010-07-08 14:05 [PATCH] Add trace event for munmap Eric B Munson
  2010-07-08 14:15 ` Rik van Riel
@ 2010-07-08 14:22 ` Peter Zijlstra
  2010-07-08 14:44   ` Eric B Munson
  1 sibling, 1 reply; 7+ messages in thread
From: Peter Zijlstra @ 2010-07-08 14:22 UTC (permalink / raw)
  To: Eric B Munson
  Cc: akpm, mingo, hugh.dickins, riel, linux-kernel, linux-mm, anton

On Thu, 2010-07-08 at 15:05 +0100, Eric B Munson wrote:
> This patch adds a trace event for munmap which will record the starting
> address of the unmapped area and the length of the umapped area.  This
> event will be used for modeling memory usage.

Does it make sense to couple this with a mmap()/mremap()/brk()
tracepoint?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add trace event for munmap
  2010-07-08 14:22 ` Peter Zijlstra
@ 2010-07-08 14:44   ` Eric B Munson
  2010-07-08 17:35     ` Christoph Hellwig
  0 siblings, 1 reply; 7+ messages in thread
From: Eric B Munson @ 2010-07-08 14:44 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Eric B Munson, akpm, mingo, hugh.dickins, riel, linux-kernel,
	linux-mm, anton

[-- Attachment #1: Type: text/plain, Size: 613 bytes --]

On Thu, 08 Jul 2010, Peter Zijlstra wrote:

> On Thu, 2010-07-08 at 15:05 +0100, Eric B Munson wrote:
> > This patch adds a trace event for munmap which will record the starting
> > address of the unmapped area and the length of the umapped area.  This
> > event will be used for modeling memory usage.
> 
> Does it make sense to couple this with a mmap()/mremap()/brk()
> tracepoint?
> 

We were using the mmap information collected by perf, but I think
those might also be useful so I will send a followup patch to add
them.

-- 
Eric B Munson
IBM Linux Technology Center
emunson@mgebm.net


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add trace event for munmap
  2010-07-08 14:44   ` Eric B Munson
@ 2010-07-08 17:35     ` Christoph Hellwig
  2010-07-08 17:48       ` Peter Zijlstra
  0 siblings, 1 reply; 7+ messages in thread
From: Christoph Hellwig @ 2010-07-08 17:35 UTC (permalink / raw)
  To: Eric B Munson
  Cc: Peter Zijlstra, Eric B Munson, akpm, mingo, hugh.dickins, riel,
	linux-kernel, linux-mm, anton

On Thu, Jul 08, 2010 at 03:44:07PM +0100, Eric B Munson wrote:
> On Thu, 08 Jul 2010, Peter Zijlstra wrote:
> 
> > On Thu, 2010-07-08 at 15:05 +0100, Eric B Munson wrote:
> > > This patch adds a trace event for munmap which will record the starting
> > > address of the unmapped area and the length of the umapped area.  This
> > > event will be used for modeling memory usage.
> > 
> > Does it make sense to couple this with a mmap()/mremap()/brk()
> > tracepoint?
> > 
> 
> We were using the mmap information collected by perf, but I think
> those might also be useful so I will send a followup patch to add
> them.

What kind of infrastructure is perf using for recording
mmap()/mremap()/brk() information?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add trace event for munmap
  2010-07-08 17:35     ` Christoph Hellwig
@ 2010-07-08 17:48       ` Peter Zijlstra
  2010-07-08 17:51         ` Christoph Hellwig
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Zijlstra @ 2010-07-08 17:48 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Eric B Munson, Eric B Munson, akpm, mingo, hugh.dickins, riel,
	linux-kernel, linux-mm, anton

On Thu, 2010-07-08 at 13:35 -0400, Christoph Hellwig wrote:

> What kind of infrastructure is perf using for recording
> mmap()/mremap()/brk() information?

A direct hook into mmap_region(), see perf_event_mmap().

We used to only track VM_EXEC regions, but these days we can also track
data regions (although it wouldn't track mremap and brk I think).

We need the VM_EXEC maps to make sense of the instruction pointer
samples.

Eric recently added support for !VM_EXEC mmap() in order to interpret
linear addresses provided by things like the software pagefault events
and certain powerpc hardware events.


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Add trace event for munmap
  2010-07-08 17:48       ` Peter Zijlstra
@ 2010-07-08 17:51         ` Christoph Hellwig
  0 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2010-07-08 17:51 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Christoph Hellwig, Eric B Munson, Eric B Munson, akpm, mingo,
	hugh.dickins, riel, linux-kernel, linux-mm, anton

On Thu, Jul 08, 2010 at 07:48:08PM +0200, Peter Zijlstra wrote:
> On Thu, 2010-07-08 at 13:35 -0400, Christoph Hellwig wrote:
> 
> > What kind of infrastructure is perf using for recording
> > mmap()/mremap()/brk() information?
> 
> A direct hook into mmap_region(), see perf_event_mmap().
> 
> We used to only track VM_EXEC regions, but these days we can also track
> data regions (although it wouldn't track mremap and brk I think).
> 
> We need the VM_EXEC maps to make sense of the instruction pointer
> samples.
> 
> Eric recently added support for !VM_EXEC mmap() in order to interpret
> linear addresses provided by things like the software pagefault events
> and certain powerpc hardware events.

Maybe the user reporting should use trace points everywhere, leaving
the direct hook just for the executable tracking?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-07-08 17:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-08 14:05 [PATCH] Add trace event for munmap Eric B Munson
2010-07-08 14:15 ` Rik van Riel
2010-07-08 14:22 ` Peter Zijlstra
2010-07-08 14:44   ` Eric B Munson
2010-07-08 17:35     ` Christoph Hellwig
2010-07-08 17:48       ` Peter Zijlstra
2010-07-08 17:51         ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).