[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171030102052.lsmpxbnzqtkedfzo@hirez.programming.kicks-ass.net>
Date: Mon, 30 Oct 2017 11:20:52 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Tejun Heo <tj@...nel.org>
Cc: Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
linux-kernel@...r.kernel.org,
David Carrillo-Cisneros <davidcc@...gle.com>,
kernel-team@...com, eranian@...il.com
Subject: Re: [PATCH] cgroup, perf_event: Fix perf cgroup hierarchy support
On Sat, Oct 28, 2017 at 09:49:37AM -0700, Tejun Heo wrote:
> 864c2357ca89 ("perf/core: Do not set cpuctx->cgrp for unscheduled
> cgroups") made list_update_cgroup_event() skip setting cpuctx->cgrp if
> no cgroup event targets %current's cgroup. This breaks perf_event's
> hierarchical support because events which target one of the ancestors
> get ignored.
>
> Fix it by using cgroup_is_descendant() test instead of equality.
Right similar to:
e6a5203399d1 ("perf/core: Fix cgroup time when scheduling descendants")
> Signed-off-by: Tejun Heo <tj@...nel.org>
> Fixes: 864c2357ca89 ("perf/core: Do not set cpuctx->cgrp for unscheduled cgroups")
> Cc: stable@...r.kernel.org # v4.9+
> Cc: David Carrillo-Cisneros <davidcc@...gle.com>
I think David left Google (I've had this email bounce), lets add
Stephane.
Cc: Stephane Eranian <eranian@...il.com>
Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> ---
> kernel/events/core.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 9d93db8..db2e630 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -901,9 +901,12 @@ list_update_cgroup_event(struct perf_event *event,
> cpuctx_entry = &cpuctx->cgrp_cpuctx_entry;
> /* cpuctx->cgrp is NULL unless a cgroup event is active in this CPU .*/
> if (add) {
> + struct perf_cgroup *cgrp = perf_cgroup_from_task(current, ctx);
> +
> list_add(cpuctx_entry, this_cpu_ptr(&cgrp_cpuctx_list));
> - if (perf_cgroup_from_task(current, ctx) == event->cgrp)
> - cpuctx->cgrp = event->cgrp;
> + if (cgroup_is_descendant(cgrp->css.cgroup,
> + event->cgrp->css.cgroup))
> + cpuctx->cgrp = cgrp;
> } else {
> list_del(cpuctx_entry);
> cpuctx->cgrp = NULL;
Powered by blists - more mailing lists