From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: "Zhu, DengCheng" <dczhu@mips.com>
Cc: "Barzilay, Eyal" <eyal@mips.com>,
"Fortuna, Zenon" <zenon@mips.com>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
"ralf@linux-mips.org" <ralf@linux-mips.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v2 5/5] perf: Enable applicable siblings when group leader is enable-on-exec
Date: Tue, 22 Nov 2011 14:45:59 +0100 [thread overview]
Message-ID: <1321969559.14799.7.camel@twins> (raw)
In-Reply-To: <BD04AF0D5BE72443A0B69C1C0486AD3ECE8DA82C@exchdb03.mips.com>
On Tue, 2011-11-22 at 13:24 +0000, Zhu, DengCheng wrote:
> > ________________________________________
> > From: Peter Zijlstra [a.p.zijlstra@chello.nl]
> > Sent: Tuesday, November 22, 2011 6:51 PM
> > To: Zhu, DengCheng
> > Cc: Barzilay, Eyal; Fortuna, Zenon; Paul Mackerras; Ingo Molnar; Arnaldo Carvalho de Melo; ralf@linux-mips.org; LKML
> > Subject: Re: [PATCH v2 5/5] perf: Enable applicable siblings when group leader is enable-on-exec
> >
> > On Tue, 2011-11-22 at 11:30 +0800, Deng-Cheng Zhu wrote:
> >> Currently, when grouped events are created disabled and enable-on-exec, the
> >> siblings won't be enabled on exec in fact. The problem looks like this:
> >
> > Arguably that's a daft thing to do, since if the leader is disabled the
> > group won't get scheduled anyway. But I guess we should at least try to
> > deal with it when people do do it.
>
> Well, by "grouped events" I mean "all of the grouped events", not only the
> group leader. In fact the leader (and only the leader) will be enabled by
> going through ctx->flexible_groups in perf_event_enable_on_exec().
Right, I understood that. What I said was daft was to tag the
non-leaders as enabled_on_exec,disabled. They wouldn't get scheduled
anyway for as long as the leader is off.
> > Seems perf-stat is a bit daft this way.
> >
> >> This patch fixes it.
> >
> > I guess it does, but its not pretty, event_enable_on_exec() already
> > calls __perf_event_mark_enable(), now this recursion is limited because
> > siblings can't have a sibling list of their own, but still.
>
> I did it like this just by reading the code comment of
> __perf_event_mark_enabled(): "Enabling the leader of a group effectively
> enables all the group members that aren't explicitly disabled ... Note:
> this works for group members as well as group leaders since the non-leader
> members' sibling_lists will be empty."
>
> So I suppose dealing with siblings' state in this traversal is the right
> thing to do and introduces minimal code turmoil, although the latter is by
> no means critical.
Yeah, I just don't really like the recursion thing... Also, there's more
ways to get to __perf_event_mark_enabled() and not all those want to
actually do enable_on_exec().
> > The below is a somewhat larger patch that avoids the recursion (and does
> > a small cleanup by eradicating all those useless ctx arguments). Quick
> > testing seems to indicate it works, but please confirm.
>
> I have no objection of deleting the redundant ctx arguments, but that's
> another topic.
Yeah, I should probably split that into a separate patch.
next prev parent reply other threads:[~2011-11-22 13:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-22 3:30 [PATCH v2 5/5] perf: Enable applicable siblings when group leader is enable-on-exec Deng-Cheng Zhu
2011-11-22 10:51 ` Peter Zijlstra
2011-11-22 13:24 ` Zhu, DengCheng
2011-11-22 13:45 ` Peter Zijlstra [this message]
2011-11-22 14:20 ` Zhu, DengCheng
2011-11-22 14:23 ` Peter Zijlstra
2011-11-23 3:38 ` Deng-Cheng Zhu
2011-11-23 11:39 ` Peter Zijlstra
2011-11-23 12:40 ` Zhu, DengCheng
2011-11-23 12:48 ` Peter Zijlstra
2011-11-24 3:06 ` Deng-Cheng Zhu
2011-12-06 9:47 ` [tip:perf/core] perf: Fix enable_on_exec for sibling events tip-bot for Peter Zijlstra
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=1321969559.14799.7.camel@twins \
--to=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=dczhu@mips.com \
--cc=eyal@mips.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=ralf@linux-mips.org \
--cc=zenon@mips.com \
/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