linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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
Subject: Re: [PATCH] perf: correct ctx_event_type in ctx_resched()
Date: Tue, 6 Mar 2018 09:54:36 +0100	[thread overview]
Message-ID: <20180306085436.GA25201@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20180306055504.3283731-1-songliubraving@fb.com>

On Mon, Mar 05, 2018 at 09:55:04PM -0800, Song Liu wrote:
> In ctx_resched(), EVENT_FLEXIBLE should be sched_out when EVENT_PINNED is
> added. However, ctx_resched() calculates ctx_event_type before checking
> this condition. As a result, pinned events will NOT get higher priority
> than flexible events.
> 
> The following shows this issue on an Intel CPU (where ref-cycles can
> only use one hardware counter).
> 
>   1. First start:
>        perf stat -C 0 -e ref-cycles  -I 1000
>   2. Then, in the second console, run:
>        perf stat -C 0 -e ref-cycles:D -I 1000
> 
> The second perf uses pinned events, which is expected to have higher
> priority. However, because it failed in ctx_resched(). It is never
> run.
> 
> This patch fixes this by calculating ctx_event_type after re-evaluating
> event_type.
> 
> Fixes: 487f05e18aa4 ("perf/core: Optimize event rescheduling on active contexts")
> Signed-off-by: Song Liu <songliubraving@fb.com>
> Reported-by: Ephraim Park <ephiepark@fb.com>

Thanks!

  reply	other threads:[~2018-03-06  8:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-06  5:55 [PATCH] perf: correct ctx_event_type in ctx_resched() Song Liu
2018-03-06  8:54 ` Peter Zijlstra [this message]
2018-03-09  9:07 ` [tip:perf/urgent] perf/core: Fix " tip-bot for 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=20180306085436.GA25201@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=ephiepark@fb.com \
    --cc=jolsa@redhat.com \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=songliubraving@fb.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;
as well as URLs for NNTP newsgroup(s).