[tip:perf/urgent] perf/core: Fix cgroup time when scheduling descendants

From: tip-bot for leilei.lin
Date: Tue Oct 10 2017 - 06:58:02 EST


Commit-ID: e6a5203399d19871021c1fa0eb2a08fc63b67e91
Gitweb: https://git.kernel.org/tip/e6a5203399d19871021c1fa0eb2a08fc63b67e91
Author: leilei.lin <leilei.lin@xxxxxxxxxxxxxxx>
AuthorDate: Fri, 29 Sep 2017 13:54:44 +0800
Committer: Ingo Molnar <mingo@xxxxxxxxxx>
CommitDate: Tue, 10 Oct 2017 10:06:55 +0200

perf/core: Fix cgroup time when scheduling descendants

Update cgroup time when an event is scheduled in by descendants.

Reviewed-and-tested-by: Jiri Olsa <jolsa@xxxxxxxxxx>
Signed-off-by: leilei.lin <leilei.lin@xxxxxxxxxxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Stephane Eranian <eranian@xxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: acme@xxxxxxxxxx
Cc: alexander.shishkin@xxxxxxxxxxxxxxx
Cc: brendan.d.gregg@xxxxxxxxx
Cc: yang_oliver@xxxxxxxxxxx
Link: http://lkml.kernel.org/r/CALPjY3mkHiekRkRECzMi9G-bjUQOvOjVBAqxmWkTzc-g+0LwMg@xxxxxxxxxxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
---
kernel/events/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 243bfc6..9d93db8 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -662,7 +662,7 @@ static inline void update_cgrp_time_from_event(struct perf_event *event)
/*
* Do not update time when cgroup is not active
*/
- if (cgrp == event->cgrp)
+ if (cgroup_is_descendant(cgrp->css.cgroup, event->cgrp->css.cgroup))
__update_cgrp_time(event->cgrp);
}