perf_event: Provide vmalloc() based mmap() backing
Subsystems (2)
Commit-ID: 9c4bcf34b02533056f59f8d35fb5894c2f5b84bc Gitweb: http://git.kernel.org/tip/9c4bcf34b02533056f59f8d35fb5894c2f5b84bc Author: Peter Zijlstra <[email protected]> AuthorDate: Mon, 21 Sep 2009 16:08:49 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 25 Sep 2009 10:42:44 +0200
perf_event: Provide vmalloc() based mmap() backing
Some architectures such as Sparc, ARM and MIPS (basically everything with flush_dcache_page()) need to deal with dcache aliases by carefully placing pages in both kernel and user maps.
These architectures typically have to use vmalloc_user() for this.
However, on other architectures, vmalloc() is not needed and has the downsides of being more restricted and slower than regular allocations.
Acked-by David Miller <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Jens Axboe <[email protected]>
Cc Paul Mackerras <[email protected]>
LKML-Reference: <new-submission>
Signed-off-by Peter Zijlstra <[email protected]>
Signed-off-by Ingo Molnar <[email protected]>
--- arch/sparc/Kconfig | 2 + include/linux/perf_event.h | 5 + init/Kconfig | 17 +++ kernel/perf_event.c | 248 +++++++++++++++++++++++++++++++++----------- tools/perf/design.txt | 3 + 5 files changed, 213 insertions(+), 62 deletions(-)
arch/sparc/Kconfig +2 -0
@@ -26,6 +26,7 @@ config SPARC select RTC_CLASS select RTC_DRV_M48T59 select HAVE_PERF_EVENTS + select PERF_NEEDS_VMALLOC select HAVE_DMA_ATTRS select HAVE_DMA_API_DEBUG
@@ -48,6 +49,7 @@ config SPARC64 select RTC_DRV_SUN4V select RTC_DRV_STARFIRE select HAVE_PERF_EVENTS + select PERF_NEEDS_VMALLOC config ARCH_DEFCONFIG string
include/linux/perf_event.h +5 -0
@@ -442,6 +442,7 @@ enum perf_callchain_context {#include <linux/hrtimer.h> #include <linux/fs.h> #include <linux/pid_namespace.h> +#include <linux/workqueue.h> #include <asm/atomic.h> #define PERF_MAX_STACK_DEPTH 255
@@ -513,6 +514,10 @@ struct file;struct perf_mmap_data {struct rcu_head rcu_head; +#ifdef CONFIG_PERF_WANTS_VMALLOC +struct work_struct work; +#endif +int data_order;int nr_pages;/* nr of data pages */ int writable;/* are we writable */ int nr_locked;/* nr pages mlocked */
init/Kconfig +17 -0
@@ -921,6 +921,11 @@ config HAVE_PERF_EVENTS help See tools/perf/design.txt for details. +config PERF_NEEDS_VMALLOC + bool + help + See tools/perf/design.txt for details + menu "Kernel Performance Events And Counters" config PERF_EVENTS
@@ -976,6 +981,18 @@ config PERF_COUNTERS Say N if unsure. +config PERF_WANTS_VMALLOC + bool "Use vmalloc to back perf mmap() buffers" + default y if (PERF_NEEDS_VMALLOC) + depends on PERF_EVENTS + help + Use vmalloc memory to back perf mmap() buffers. + + Mostly useful for debugging the vmalloc code on platforms + that don't require it. + + Say N if unsure. + endmenu config VM_EVENT_COUNTERS
kernel/perf_event.c +186 -62
348 lines not on this page · raw message
tools/perf/design.txt +3 -0
@@ -455,3 +455,6 @@ will need at least this: If your architecture does have hardware capabilities, you can override the weak stub hw_perf_event_init() to register hardware counters. + +Architectures that have d-cache aliassing issues, such as Sparc and ARM, +should select PERF_NEEDS_VMALLOC in order to avoid these for perf mmap().