mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Liang, Kan" <kan.liang@linux.intel.com>
Cc: mingo@kernel.org, linux-kernel@vger.kernel.org,
	namhyung@kernel.org, eranian@google.com, irogers@google.com,
	gmx@google.com, acme@kernel.org, jolsa@redhat.com,
	ak@linux.intel.com
Subject: Re: [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events
Date: Mon, 9 Nov 2020 18:40:59 +0100	[thread overview]
Message-ID: <20201109174059.GN2611@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <0a1db246-c34a-22a3-160c-3e0c0a38119d@linux.intel.com>

On Mon, Nov 09, 2020 at 09:49:31AM -0500, Liang, Kan wrote:

> - The patch 1 tries to fix broken per-CPU events. The CPU context cannot be
> retrieved from the task->perf_event_ctxp. So it has to be tracked in the
> sched_cb_list. Yes, the code is very similar to the original codes, but it
> is actually the new code for per-CPU events. The optimization for per-task
> events is still kept.
>   For the case, which has both a CPU context and a task context, yes, the
> __perf_pmu_sched_task() in this patch is not invoked. Because the
> sched_task() only need to be invoked once in a context switch. The
> sched_task() will be eventually invoked in the task context.
> 
> 
> - The following patch 3 tries to optimize the sched_task() further.
>   - We handle the per-CPU event and per-task event in different places. In a
> pure per-task context, we don't need to go through the sched_cb_list. We can
> get the information from task->perf_event_ctxp. We introduce a flag to
> distinguish them.
>   - For most of the cases, we don't need to invoke the sched_task() in both
> sched in and sched out. We also introduce a flag for PMUs to avoid
> unnecessary calls.
> 

There's a further optimiation possible; we can have pmu::swap_task_ctx()
imply pmu::sched_task() (both in and out).


It's all a bit of a mess though.. let me consider.

  parent reply	other threads:[~2020-11-09 17:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06 21:29 kan.liang
2020-11-06 21:29 ` [PATCH 2/3] perf/x86/intel: Set PERF_ATTACH_SCHED_CB for large PEBS kan.liang
2020-11-06 21:29 ` [PATCH 3/3] perf: Optimize sched_task() in a context switch kan.liang
2020-11-09  9:52 ` [PATCH 1/3] perf/core: Flush PMU internal buffers for per-CPU events Peter Zijlstra
2020-11-09 11:04   ` Peter Zijlstra
2020-11-09 14:49     ` Liang, Kan
2020-11-09 17:33       ` Peter Zijlstra
2020-11-09 19:52         ` Liang, Kan
2020-11-09 17:40       ` Peter Zijlstra [this message]
2020-11-11 16:25       ` Peter Zijlstra
2020-11-11 19:54         ` Liang, Kan
2020-11-17  5:01           ` Namhyung Kim
2020-11-20 11:24             ` Namhyung Kim
2020-11-23 11:00               ` Michael Ellerman
2020-11-24  4:51                 ` Namhyung Kim
2020-11-24  5:42                   ` Madhavan Srinivasan
2020-11-24 16:04                     ` Liang, Kan
2020-11-25  8:12                   ` Michael Ellerman

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=20201109174059.GN2611@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=eranian@google.com \
    --cc=gmx@google.com \
    --cc=irogers@google.com \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®