public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Andi Kleen <ak@linux.intel.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v5 1/3] perf/core: store context switch out type into Perf trace
Date: Mon, 9 Apr 2018 11:26:03 +0200	[thread overview]
Message-ID: <20180409092603.GY4043@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <9ff84e83-a0ca-dd82-a6d0-cb951689be74@linux.intel.com>

On Mon, Apr 09, 2018 at 10:25:32AM +0300, Alexey Budankov wrote:
> 
> Store preempting context switch out event into Perf trace as a part of 
> PERF_RECORD_SWITCH[_CPU_WIDE] record.
> 
> Percentage of preempting and non-preempting context switches help 
> understanding the nature of workloads (CPU or IO bound) that are running 
> on a machine;
> 
> The event is treated as preemption one when task->state value of the 
> thread being switched out is TASK_RUNNING. Event type encoding is 
> implemented using PERF_RECORD_MISC_SWITCH_OUT_PREEMPT bit;
> 	
> Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com>

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

Acme, I'm thinking you should route this, since most of the changes are
actually to the tool.

> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index fc1c330c6bd6..872a5aaa77eb 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -7584,6 +7584,10 @@ static void perf_event_switch(struct task_struct *task,
>  		},
>  	};
>  
> +	if (!sched_in && task->state == TASK_RUNNING)
> +		switch_event.event_id.header.misc |=
> +				PERF_RECORD_MISC_SWITCH_OUT_PREEMPT;

I typically prefer {} over any multi-line expression.

>  	perf_iterate_sb(perf_event_switch_output,
>  		       &switch_event,
>  		       NULL);

  reply	other threads:[~2018-04-09  9:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-09  7:20 [PATCH v5 0/3] perf/core: expose thread context switch out event type to user space Alexey Budankov
2018-04-09  7:25 ` [PATCH v5 1/3] perf/core: store context switch out type into Perf trace Alexey Budankov
2018-04-09  9:26   ` Peter Zijlstra [this message]
2018-04-09  9:56     ` Alexey Budankov
2018-04-16  8:29     ` Alexey Budankov
2018-04-16 13:59       ` Arnaldo Carvalho de Melo
2018-04-16 14:28       ` Arnaldo Carvalho de Melo
2018-04-21  7:46   ` [tip:perf/urgent] perf/core: Store context switch out type in PERF_RECORD_SWITCH[_CPU_WIDE] tip-bot for Alexey Budankov
2018-04-09  7:26 ` [PATCH v5 2/3] perf report: extend raw dump (-D) out with switch out event type Alexey Budankov
2018-04-21  7:47   ` [tip:perf/urgent] perf report: Extend " tip-bot for Alexey Budankov
2018-04-09  7:26 ` [PATCH v5 3/3] perf script: extend misc field decoding " Alexey Budankov
2018-04-21  7:47   ` [tip:perf/urgent] perf script: Extend " tip-bot for Alexey Budankov
  -- strict thread matches above, loose matches on Subject: below --
2018-04-04 12:49 [PATCH v5 0/3] perf/core: expose thread context switch out event type to user space Alexey Budankov
2018-04-04 13:02 ` [PATCH v5 1/3] perf/core: store context switch out type into Perf trace Alexey Budankov
2018-03-30  4:54 [PATCH v5 0/3] perf/core: expose thread context switch out event type to user space Alexey Budankov
2018-03-30  5:00 ` [PATCH v5 1/3] perf/core: store context switch out type into Perf trace Alexey Budankov

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=20180409092603.GY4043@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexey.budankov@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@redhat.com \
    --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