From: Eric B Munson <emunson@mgebm.net>
To: akpm@linux-foundation.org
Cc: mingo@redhat.com, hugh.dickins@tiscali.co.uk, riel@redhat.com,
peterz@infradead.org, anton@samba.org, hch@infradead.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Eric B Munson <emunson@mgebm.net>
Subject: [PATCH 2/2] Add trace point to mremap
Date: Fri, 9 Jul 2010 16:53:50 +0100 [thread overview]
Message-ID: <1278690830-22145-2-git-send-email-emunson@mgebm.net> (raw)
In-Reply-To: <1278690830-22145-1-git-send-email-emunson@mgebm.net>
This patch completes the trace point addition to the [m|mre|mun]map
and brk functions. These trace points will be used by a userspace
tool that models application memory usage.
Signed-off-by: Eric B Munson <emunson@mgebm.net>
---
include/trace/events/mremap.h | 37 +++++++++++++++++++++++++++++++++++++
mm/mremap.c | 5 +++++
2 files changed, 42 insertions(+), 0 deletions(-)
create mode 100644 include/trace/events/mremap.h
diff --git a/include/trace/events/mremap.h b/include/trace/events/mremap.h
new file mode 100644
index 0000000..754a43b
--- /dev/null
+++ b/include/trace/events/mremap.h
@@ -0,0 +1,37 @@
+#if !defined(_TRACE_MREMAP_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_MREMAP_H_
+
+#include <linux/tracepoint.h>
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM mremap
+
+TRACE_EVENT(mremap,
+ TP_PROTO(unsigned long addr, unsigned long old_len,
+ unsigned long new_addr, unsigned long new_len),
+
+ TP_ARGS(addr, old_len, new_addr, new_len),
+
+ TP_STRUCT__entry(
+ __field(unsigned long, addr)
+ __field(unsigned long, old_len)
+ __field(unsigned long, new_addr)
+ __field(unsigned long, new_len)
+ ),
+
+ TP_fast_assign(
+ __entry->addr = addr;
+ __entry->old_len = old_len;
+ __entry->new_addr = new_addr;
+ __entry->new_len = new_len;
+ ),
+
+ TP_printk("remapping %lu bytes from %lu to %lu bytes at %lu\n",
+ __entry->old_len, __entry->addr, __entry->new_len,
+ __entry->new_addr)
+);
+
+#endif /* _TRACE_MREMAP_H_ */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
diff --git a/mm/mremap.c b/mm/mremap.c
index cde56ee..b3aaff0 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -20,6 +20,9 @@
#include <linux/syscalls.h>
#include <linux/mmu_notifier.h>
+#define CREATE_TRACE_POINTS
+#include <trace/events/mremap.h>
+
#include <asm/uaccess.h>
#include <asm/cacheflush.h>
#include <asm/tlbflush.h>
@@ -504,6 +507,8 @@ unsigned long do_mremap(unsigned long addr,
out:
if (ret & ~PAGE_MASK)
vm_unacct_memory(charged);
+ else
+ trace_mremap(addr, old_len, new_addr, new_len);
return ret;
}
--
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>
next prev parent reply other threads:[~2010-07-09 15:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-09 15:53 [PATCH 1/2] Add trace events to mmap and brk Eric B Munson
2010-07-09 15:53 ` Eric B Munson [this message]
2010-07-09 16:02 ` [PATCH 2/2] Add trace point to mremap Christoph Hellwig
2010-07-09 16:03 ` [PATCH 1/2] Add trace events to mmap and brk Christoph Hellwig
2010-07-12 1:58 ` KOSAKI Motohiro
2010-07-10 1:17 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1278690830-22145-2-git-send-email-emunson@mgebm.net \
--to=emunson@mgebm.net \
--cc=akpm@linux-foundation.org \
--cc=anton@samba.org \
--cc=hch@infradead.org \
--cc=hugh.dickins@tiscali.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox