[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 09 Sep 2010 15:52:02 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: eranian@...gle.com
Cc: linux-kernel@...r.kernel.org, peterz@...radead.org, mingo@...e.hu,
paulus@...ba.org, davem@...emloft.net, fweisbec@...il.com,
perfmon2-devel@...ts.sf.net, eranian@...il.com,
robert.richter@....com, acme@...hat.com
Subject: Re: [RFC PATCH 1/2] perf_events: add support for per-cpu
per-cgroup monitoring (v3)
Le jeudi 09 septembre 2010 à 06:09 -0700, Stephane Eranian a écrit :
> This kernel patch adds the ability to filter monitoring based on
> container groups (cgroups). This is for use in per-cpu mode only.
>
> The patch adds perf_event_attr.cgroup, a boolean, to activate
> this new mode. The cgroup is designated by passing in
> perf_event_attr.cgroup_fd, an opened file descriptor to
> the <mnt>/<cgroup>/perf_event.perf file.
>
> This is the second version of this patch. It corrects the way
> time_enabled is accounted for. In cgroup mode, time_enabled reflects
> the time the cgroup was active, i.e., threads from the cgroup executed
> on the monitored CPU. This is a more useful metric than just
> wall-clock. The meaning of time_enabled without cgroup is unaffected.
>
> Signed-off-by: Stephane Eranian <eranian@...gle.com>
> +#ifdef CONFIG_CGROUPS
> +struct perf_cgroup_time {
> + u64 time;
> + u64 timestamp;
> +};
> +
> +struct perf_cgroup {
> + struct cgroup_subsys_state css;
> + struct perf_cgroup_time *time;
struct perf_cgroup_time __percpu *time;
Please run sparse after this "__percpu" change.
> +};
> +#endif
> +
> /*
> +
> + jc->time = alloc_percpu(struct perf_cgroup_time);
> + if (!jc->time) {
> + vfree(jc);
> + return ERR_PTR(-ENOMEM);
> + }
> +
> + for_each_possible_cpu(c) {
> + t = per_cpu_ptr(jc->time, c);
> + t->time = 0;
> + t->timestamp = 0;
> + }
alloc_percpu() is zalloc_percpu() in fact, memory is already cleared.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists