Skip to content

Commit

Permalink
perf_event: Provide vmalloc() based mmap() backing
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: David Miller <davem@davemloft.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1254830228.21044.272.camel@laptop>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Oct 6, 2009
1 parent e13dbd7 commit 906010b
Show file tree
Hide file tree
Showing 5 changed files with 214 additions and 62 deletions.
2 changes: 2 additions & 0 deletions arch/sparc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ config SPARC
select RTC_CLASS
select RTC_DRV_M48T59
select HAVE_PERF_EVENTS
select PERF_USE_VMALLOC
select HAVE_DMA_ATTRS
select HAVE_DMA_API_DEBUG

Expand All @@ -48,6 +49,7 @@ config SPARC64
select RTC_DRV_SUN4V
select RTC_DRV_STARFIRE
select HAVE_PERF_EVENTS
select PERF_USE_VMALLOC

config ARCH_DEFCONFIG
string
Expand Down
5 changes: 5 additions & 0 deletions include/linux/perf_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -513,6 +514,10 @@ struct file;

struct perf_mmap_data {
struct rcu_head rcu_head;
#ifdef CONFIG_PERF_USE_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 */
Expand Down
18 changes: 18 additions & 0 deletions init/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,11 @@ config HAVE_PERF_EVENTS
help
See tools/perf/design.txt for details.

config PERF_USE_VMALLOC
bool
help
See tools/perf/design.txt for details

menu "Kernel Performance Events And Counters"

config PERF_EVENTS
Expand Down Expand Up @@ -976,6 +981,19 @@ config PERF_COUNTERS

Say N if unsure.

config DEBUG_PERF_USE_VMALLOC
default n
bool "Debug: use vmalloc to back perf mmap() buffers"
depends on PERF_EVENTS && DEBUG_KERNEL
select PERF_USE_VMALLOC
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
Expand Down
Loading

0 comments on commit 906010b

Please sign in to comment.