mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] perf_counter: Add mmap event hooks to mprotect()
@ 2009-06-08 18:11 Pekka J Enberg
  2009-06-08 21:33 ` [tip:perfcounters/core] " tip-bot for Peter Zijlstra
  0 siblings, 1 reply; 2+ messages in thread
From: Pekka J Enberg @ 2009-06-08 18:11 UTC (permalink / raw)
  To: mingo; +Cc: linux-kernel, a.p.zijlstra, acme

From: Peter Zijlstra <a.p.zijlstra@chello.nl>

Some JIT compilers allocate memory for generated code with
posix_memalign() + mprotect() so we need to hook into mprotect() to make
sure 'perf' is aware that we're executing code in anonymous memory.

[ penberg@cs.helsinki.fi: move the hook to sys_mprotect() ]
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
 mm/mprotect.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/mm/mprotect.c b/mm/mprotect.c
index 258197b..d80311b 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -23,6 +23,7 @@
 #include <linux/swapops.h>
 #include <linux/mmu_notifier.h>
 #include <linux/migrate.h>
+#include <linux/perf_counter.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/cacheflush.h>
@@ -299,6 +300,7 @@ SYSCALL_DEFINE3(mprotect, unsigned long, start, size_t, len,
 		error = mprotect_fixup(vma, &prev, nstart, tmp, newflags);
 		if (error)
 			goto out;
+		perf_counter_mmap(vma);
 		nstart = tmp;
 
 		if (nstart < prev->vm_end)
-- 
1.5.6.3


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

end of thread, other threads:[~2009-06-08 21:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-08 18:11 [PATCH 1/2] perf_counter: Add mmap event hooks to mprotect() Pekka J Enberg
2009-06-08 21:33 ` [tip:perfcounters/core] " tip-bot for Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®