* [PATCH] perf/core: Update cgroup time with descendants
@ 2017-09-14 7:03 linxiulei
2017-09-19 2:02 ` Lin Xiulei
0 siblings, 1 reply; 3+ messages in thread
From: linxiulei @ 2017-09-14 7:03 UTC (permalink / raw)
To: yang_oliver, peterz, mingo, acme, alexander.shishkin,
linux-kernel, tglx, eranian, torvalds, jolsa
Cc: leilei.lin
From: "leilei.lin" <leilei.lin@alibaba-inc.com>
This fix updating cgroup time when event is being scheduled in
by cgroup descendants
Signed-off-by: leilei.lin <leilei.lin@alibaba-inc.com>
---
kernel/events/core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 3e691b7..6f6bd1e 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -662,7 +662,9 @@ 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 (cgrp == event->cgrp ||
+ cgroup_is_descendant(cgrp->css.cgroup,
+ event->cgrp->css.cgroup))
__update_cgrp_time(event->cgrp);
}
--
2.8.4.31.g9ed660f
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf/core: Update cgroup time with descendants
2017-09-14 7:03 [PATCH] perf/core: Update cgroup time with descendants linxiulei
@ 2017-09-19 2:02 ` Lin Xiulei
2017-09-19 8:48 ` Jiri Olsa
0 siblings, 1 reply; 3+ messages in thread
From: Lin Xiulei @ 2017-09-19 2:02 UTC (permalink / raw)
To: yang_oliver, Peter Zijlstra, mingo, acme, alexander.shishkin,
linux-kernel, tglx, Stephane Eranian, torvalds, Jiri Olsa
Cc: leilei.lin
Add steps of reproducing
1
```
mkdir /sys/fs/cgroup/perf_event/root1
mkdir /sys/fs/cgroup/perf_event/root1/leaf1
```
2 $pid is any running process
```
echo $pid > /sys/fs/cgroup/perf_event/root1/cgroup.procs
```
3
```
perf stat -e cycles -G root1 -a -I 1000
```
You shall get 0 cycles from it, which should have been cycles of $pid
2017-09-14 15:03 GMT+08:00 <linxiulei@gmail.com>:
> From: "leilei.lin" <leilei.lin@alibaba-inc.com>
>
> This fix updating cgroup time when event is being scheduled in
> by cgroup descendants
>
> Signed-off-by: leilei.lin <leilei.lin@alibaba-inc.com>
> ---
> kernel/events/core.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 3e691b7..6f6bd1e 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -662,7 +662,9 @@ 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 (cgrp == event->cgrp ||
> + cgroup_is_descendant(cgrp->css.cgroup,
> + event->cgrp->css.cgroup))
> __update_cgrp_time(event->cgrp);
> }
>
> --
> 2.8.4.31.g9ed660f
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf/core: Update cgroup time with descendants
2017-09-19 2:02 ` Lin Xiulei
@ 2017-09-19 8:48 ` Jiri Olsa
0 siblings, 0 replies; 3+ messages in thread
From: Jiri Olsa @ 2017-09-19 8:48 UTC (permalink / raw)
To: Lin Xiulei
Cc: yang_oliver, Peter Zijlstra, mingo, acme, alexander.shishkin,
linux-kernel, tglx, Stephane Eranian, torvalds, leilei.lin
On Tue, Sep 19, 2017 at 10:02:50AM +0800, Lin Xiulei wrote:
> Add steps of reproducing
>
> 1
> ```
> mkdir /sys/fs/cgroup/perf_event/root1
> mkdir /sys/fs/cgroup/perf_event/root1/leaf1
> ```
> 2 $pid is any running process
> ```
> echo $pid > /sys/fs/cgroup/perf_event/root1/cgroup.procs
> ```
>
> 3
> ```
> perf stat -e cycles -G root1 -a -I 1000
> ```
>
> You shall get 0 cycles from it, which should have been cycles of $pid
>
> 2017-09-14 15:03 GMT+08:00 <linxiulei@gmail.com>:
> > From: "leilei.lin" <leilei.lin@alibaba-inc.com>
> >
> > This fix updating cgroup time when event is being scheduled in
> > by cgroup descendants
> >
> > Signed-off-by: leilei.lin <leilei.lin@alibaba-inc.com>
> > ---
> > kernel/events/core.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/kernel/events/core.c b/kernel/events/core.c
> > index 3e691b7..6f6bd1e 100644
> > --- a/kernel/events/core.c
> > +++ b/kernel/events/core.c
> > @@ -662,7 +662,9 @@ 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 (cgrp == event->cgrp ||
> > + cgroup_is_descendant(cgrp->css.cgroup,
> > + event->cgrp->css.cgroup))
> > __update_cgrp_time(event->cgrp);
you no longer need the 'cgrp == event->cgrp', it's part
of the cgroup_is_descendant call
other than that it looks ok to me
Reviewed-and-tested-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-09-19 8:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-14 7:03 [PATCH] perf/core: Update cgroup time with descendants linxiulei
2017-09-19 2:02 ` Lin Xiulei
2017-09-19 8:48 ` Jiri Olsa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox