public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Liang, Kan" <kan.liang@linux.intel.com>
To: Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Jiri Olsa <jolsa@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
	Stephane Eranian <eranian@google.com>,
	Andi Kleen <ak@linux.intel.com>, Ian Rogers <irogers@google.com>,
	Gabriel Marin <gmx@google.com>
Subject: Re: [RFC 1/2] perf/core: Enable sched_task callbacks if PMU has it
Date: Thu, 5 Nov 2020 09:47:54 -0500	[thread overview]
Message-ID: <f92281d1-03ec-a1bc-b54f-e2b867d5b787@linux.intel.com> (raw)
In-Reply-To: <20201102145221.309001-2-namhyung@kernel.org>



On 11/2/2020 9:52 AM, Namhyung Kim wrote:
> If an event associated with a PMU which has a sched_task callback,
> it should be called regardless of cpu/task context.  For example,


I don't think it's necessary. We should call it when we have to. 
Otherwise, it just waste cycles.
Shouldn't the patch 2 be enough?

Thanks,
Kan

> a per-cpu event might enable large PEBS buffers so it needs to flush
> the buffer whenever task scheduling happens. >
> The underlying PMU may or may not require this for the given event,
> but it will be handled in the pmu::sched_task() callback anyway.
> 
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>   kernel/events/core.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index b458ed3dc81b..aaa0155c4142 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -4696,6 +4696,8 @@ static void unaccount_event(struct perf_event *event)
>   		dec = true;
>   	if (has_branch_stack(event))
>   		dec = true;
> +	if (event->pmu->sched_task)
> +		dec = true;
>   	if (event->attr.ksymbol)
>   		atomic_dec(&nr_ksymbol_events);
>   	if (event->attr.bpf_event)
> @@ -11225,6 +11227,8 @@ static void account_event(struct perf_event *event)
>   		inc = true;
>   	if (is_cgroup_event(event))
>   		inc = true;
> +	if (event->pmu->sched_task)
> +		inc = true;
>   	if (event->attr.ksymbol)
>   		atomic_inc(&nr_ksymbol_events);
>   	if (event->attr.bpf_event)
> 

  reply	other threads:[~2020-11-05 14:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-02 14:52 [RFC 0/2] perf/core: Invoke pmu::sched_task callback for cpu events Namhyung Kim
2020-11-02 14:52 ` [RFC 1/2] perf/core: Enable sched_task callbacks if PMU has it Namhyung Kim
2020-11-05 14:47   ` Liang, Kan [this message]
2020-11-05 15:45     ` Namhyung Kim
2020-11-05 19:01       ` Liang, Kan
2020-11-06  0:53         ` Namhyung Kim
2020-11-06 16:11           ` Liang, Kan
2020-11-02 14:52 ` [RFC 2/2] perf/core: Invoke pmu::sched_task callback for per-cpu events Namhyung Kim
2020-11-05 14:48   ` Liang, Kan
2020-11-05 15:54     ` Namhyung Kim
2020-11-05 19:39       ` Liang, Kan
2020-11-05 21:15         ` Stephane Eranian
2020-11-05 23:12           ` Liang, Kan
2020-11-05  8:29 ` [RFC 0/2] perf/core: Invoke pmu::sched_task callback for cpu events Stephane Eranian

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=f92281d1-03ec-a1bc-b54f-e2b867d5b787@linux.intel.com \
    --to=kan.liang@linux.intel.com \
    --cc=a.p.zijlstra@chello.nl \
    --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=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