aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorStephane Eranian <eranian@google.com>2011-02-14 04:20:01 -0500
committerIngo Molnar <mingo@elte.hu>2011-02-16 07:30:48 -0500
commite5d1367f17ba6a6fed5fd8b74e4d5720923e0c25 (patch)
tree5862b4cddb7c88e0513e503cb3f46c60da2eeb6f /init
parentd41d5a01631af821d3a3447e6613a316f5ee6c25 (diff)
perf: Add cgroup support
This kernel patch adds the ability to filter monitoring based on container groups (cgroups). This is for use in per-cpu mode only. The cgroup to monitor is passed as a file descriptor in the pid argument to the syscall. The file descriptor must be opened to the cgroup name in the cgroup filesystem. For instance, if the cgroup name is foo and cgroupfs is mounted in /cgroup, then the file descriptor is opened to /cgroup/foo. Cgroup mode is activated by passing PERF_FLAG_PID_CGROUP in the flags argument to the syscall. For instance to measure in cgroup foo on CPU1 assuming cgroupfs is mounted under /cgroup: struct perf_event_attr attr; int cgroup_fd, fd; cgroup_fd = open("/cgroup/foo", O_RDONLY); fd = perf_event_open(&attr, cgroup_fd, 1, -1, PERF_FLAG_PID_CGROUP); close(cgroup_fd); Signed-off-by: Stephane Eranian <eranian@google.com> [ added perf_cgroup_{exit,attach} ] Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <4d590250.114ddf0a.689e.4482@mx.google.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig10
1 files changed, 10 insertions, 0 deletions
diff --git a/init/Kconfig b/init/Kconfig
index be788c0957d4..20d6bd919b8d 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -683,6 +683,16 @@ config CGROUP_MEM_RES_CTLR_SWAP_ENABLED
683 select this option (if, for some reason, they need to disable it 683 select this option (if, for some reason, they need to disable it
684 then noswapaccount does the trick). 684 then noswapaccount does the trick).
685 685
686config CGROUP_PERF
687 bool "Enable perf_event per-cpu per-container group (cgroup) monitoring"
688 depends on PERF_EVENTS && CGROUPS
689 help
690 This option extends the per-cpu mode to restrict monitoring to
691 threads which belong to the cgroup specificied and run on the
692 designated cpu.
693
694 Say N if unsure.
695
686menuconfig CGROUP_SCHED 696menuconfig CGROUP_SCHED
687 bool "Group CPU scheduler" 697 bool "Group CPU scheduler"
688 depends on EXPERIMENTAL 698 depends on EXPERIMENTAL