From: Peter Zijlstra <peterz@infradead.org>
To: Song Liu <songliubraving@fb.com>
Cc: linux-kernel@vger.kernel.org, jolsa@redhat.com,
kernel-team@fb.com, ephiepark@fb.com, Tejun Heo <tj@kernel.org>,
Stephane Eranian <eranian@google.com>,
Lin Xiulei <linxiulei@gmail.com>
Subject: Re: [PATCH] perf: update perf_cgroup time for ancestor cgroup(s)
Date: Mon, 12 Mar 2018 13:38:24 +0100 [thread overview]
Message-ID: <20180312123824.GF4064@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20180312053244.2593974-1-songliubraving@fb.com>
On Sun, Mar 11, 2018 at 10:32:44PM -0700, Song Liu wrote:
> When a perf_event is attached to parent cgroup, it should count events
> for all children cgroups:
>
> parent_group <---- perf_event
> \
> - child_group <---- process(es)
>
> However, in our tests, we found this perf_event cannot report reliable
> results. This is because perf_event->cgrp and cpuctx->cgrp are not
> identical, thus perf_event->cgrp are not updated properly.
It might help now and in for our older selves, if you could provide a
simple reproducer for this.
> Signed-off-by: Song Liu <songliubraving@fb.com>
> Reported-by: Ephraim Park <ephiepark@fb.com>
> ---
> kernel/events/core.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 67 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 5789810..623d38f 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -766,6 +821,17 @@ perf_cgroup_set_timestamp(struct task_struct *task,
> cgrp = perf_cgroup_from_task(task, ctx);
> info = this_cpu_ptr(cgrp->info);
> info->timestamp = ctx->timestamp;
> +
> + /* set timestamp for ancestor cgroups */
> + if (cgrp->css.cgroup->level > 1) {
> + struct perf_cgroup_info *info = this_cpu_ptr(cgrp->info);
> + struct perf_event *event;
> +
> + list_for_each_entry(event, &ctx->pinned_groups, group_entry)
> + perf_ancestor_cgroup_set_timestamp(event, cgrp, info);
> + list_for_each_entry(event, &ctx->flexible_groups, group_entry)
> + perf_ancestor_cgroup_set_timestamp(event, cgrp, info);
> + }
> }
That doesn't make any kind of sense... if we're interested in ancestor
groups, then WTH are you iterating _events_ ?
I'm expecting something like:
struct cgroup_subsys_state *css;
for (css = cgrp->css; css; css = css->parent) {
/* fudge time */
}
next prev parent reply other threads:[~2018-03-12 12:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-12 5:32 Song Liu
2018-03-12 12:38 ` Peter Zijlstra [this message]
2018-03-12 14:52 ` Song Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180312123824.GF4064@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=ephiepark@fb.com \
--cc=eranian@google.com \
--cc=jolsa@redhat.com \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linxiulei@gmail.com \
--cc=songliubraving@fb.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®