public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: mingo@kernel.org, linux-kernel@vger.kernel.org, acme@kernel.org,
	mark.rutland@arm.com, jolsa@redhat.com, namhyung@kernel.org,
	andi@firstfloor.org, kan.liang@linux.intel.com
Subject: Re: [PATCH 1/3] perf: Optimize perf_install_in_event()
Date: Wed, 23 Oct 2019 16:08:06 +0200	[thread overview]
Message-ID: <20191023140806.GE19358@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20191023134444.GV1817@hirez.programming.kicks-ass.net>

On Wed, Oct 23, 2019 at 03:44:44PM +0200, Peter Zijlstra wrote:
> On Wed, Oct 23, 2019 at 03:30:27PM +0300, Alexander Shishkin wrote:
> > Peter Zijlstra <peterz@infradead.org> writes:
> > 
> > > +	/*
> > > +	 * perf_event_attr::disabled events will not run and can be initialized
> > > +	 * without IPI. Except when this is the first event for the context, in
> > > +	 * that case we need the magic of the IPI to set ctx->is_active.
> > > +	 *
> > > +	 * The IOC_ENABLE that is sure to follow the creation of a disabled
> > > +	 * event will issue the IPI and reprogram the hardware.
> > > +	 */
> > > +	if (__perf_effective_state(event) == PERF_EVENT_STATE_OFF && ctx->nr_events) {
> > > +		raw_spin_lock_irq(&ctx->lock);
> > > +		if (task && ctx->task == TASK_TOMBSTONE) {
> > 
> > Confused: isn't that redundant? If ctx->task reads TASK_TOMBSTONE, task
> > is always !NULL,
> 
> The test is only relevant for task contexts, that's what the first
> 'task' clause tests for, then we need to check the ctx isn't dying,
> which is the second clause 'ctx->task == TASK_TOMBSTONE'.

Urgh, n/m that. I got confused and that can indeed be simplified.

  reply	other threads:[~2019-10-23 14:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22  9:20 [PATCH 0/3] Various optimizations for event creation Peter Zijlstra
2019-10-22  9:20 ` [PATCH 1/3] perf: Optimize perf_install_in_event() Peter Zijlstra
2019-10-22 10:03   ` Peter Zijlstra
2019-10-23 12:30   ` Alexander Shishkin
2019-10-23 13:44     ` Peter Zijlstra
2019-10-23 14:08       ` Peter Zijlstra [this message]
2019-10-22  9:20 ` [PATCH 2/3] perf: Optimize perf_init_event() Peter Zijlstra
2019-10-27  5:18   ` [perf] 06e0dbcfd3: phoronix-test-suite.mbw.0.mib_s 12.6% improvement kernel test robot
2019-10-27 16:32     ` Andi Kleen
2019-10-22  9:20 ` [PATCH 3/3] perf: Optimize perf_init_event() for TYPE_SOFTWARE 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=20191023140806.GE19358@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@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