public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lin Ming <ming.m.lin@intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	Matt Fleming <matt@console-pimps.org>,
	"Zhang, Rui" <rui.zhang@intel.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	lkml <linux-kernel@vger.kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [RFC PATCH 1/2] perf: Enable group siblings on exec if attr::enable_on_exec set
Date: Wed, 10 Nov 2010 22:17:57 +0800	[thread overview]
Message-ID: <1289398677.2479.10.camel@localhost> (raw)
In-Reply-To: <1289391586.2191.100.camel@laptop>

On Wed, 2010-11-10 at 20:19 +0800, Peter Zijlstra wrote:
> On Wed, 2010-11-10 at 14:15 +0800, Lin Ming wrote:
> > Currently, only group leader is enabled on exec.
> 
> That's enough, right? If all sibling events are already enabled enabling
> the group leader makes the whole thing go.

No.

If the event group is disabled by default("perf stat" case) and will be
enabled at next exec, then actually only the group leader will be
enabled , because all siblings are explicitly disabled(->state ==
PERF_EVENT_STATE_OFF). So the siblings will never be enabled.

/*
 * Put a event into inactive state and update time fields.
 * Enabling the leader of a group effectively enables all
 * the group members that aren't explicitly disabled, so we
 * have to update their ->tstamp_enabled also.
 * Note: this works for group members as well as group leaders
 * since the non-leader members' sibling_lists will be empty.
 */             
static void __perf_event_mark_enabled(struct perf_event *event,
                                        struct perf_event_context *ctx)
{
        struct perf_event *sub;

        event->state = PERF_EVENT_STATE_INACTIVE;
        event->tstamp_enabled = ctx->time - event->total_time_enabled;
        list_for_each_entry(sub, &event->sibling_list, group_entry)
                if (sub->state >= PERF_EVENT_STATE_INACTIVE)
                        sub->tstamp_enabled =  
                                ctx->time - sub->total_time_enabled;
}




  reply	other threads:[~2010-11-10 14:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-10  6:15 [RFC PATCH 1/2] perf: Enable group siblings on exec if attr::enable_on_exec set Lin Ming
2010-11-10 12:19 ` Peter Zijlstra
2010-11-10 14:17   ` Lin Ming [this message]
2010-11-10 14:38     ` Peter Zijlstra
2010-11-10 14:49       ` Lin Ming
2010-11-10 14:54         ` 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=1289398677.2479.10.camel@localhost \
    --to=ming.m.lin@intel.com \
    --cc=acme@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@console-pimps.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rui.zhang@intel.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