public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org,
	Vince Weaver <vincent.weaver@maine.edu>
Subject: Re: [PATCH 2/2] kernel/events: Add option to enable counting sideband events in wakeup_events
Date: Wed, 12 Jul 2017 12:48:55 +0200	[thread overview]
Message-ID: <20170712104855.GA3033@krava> (raw)
In-Reply-To: <3e1d5fea814758906c64b01e1eed186daaf2c9ed.1497881378.git.naveen.n.rao@linux.vnet.ibm.com>

On Mon, Jun 19, 2017 at 08:01:08PM +0530, Naveen N. Rao wrote:

SNIP

> -	if (!event->attr.watermark) {
> +	if (!event->attr.count_sb_events && !event->attr.watermark) {
>  		int wakeup_events = event->attr.wakeup_events;
>  
>  		if (wakeup_events) {
> diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
> index 4e7c728569a8..f43a6081141f 100644
> --- a/kernel/events/ring_buffer.c
> +++ b/kernel/events/ring_buffer.c
> @@ -197,6 +197,19 @@ __perf_output_begin(struct perf_output_handle *handle,
>  	 * none of the data stores below can be lifted up by the compiler.
>  	 */
>  
> +	if (event->attr.count_sb_events && !event->attr.watermark) {
> +		int wakeup_events = event->attr.wakeup_events;
> +
> +		if (wakeup_events) {
> +			int events = local_inc_return(&rb->events);
> +
> +			if (events >= wakeup_events) {
> +				local_sub(wakeup_events, &rb->events);
> +				local_inc(&rb->wakeup);
> +			}
> +		}
> +	}

hum, so there's the same wakeup code in perf_output_sample,
but it's not called for non-sample (sideband) events

it'd be nice to have this wakeup only once in __perf_output_begin,
but it'd change the behaviour for sideband events, which would start to
follow the wakeup_events logic.. and possibly disturb Vince's tests?

jirka

  reply	other threads:[~2017-07-12 10:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-19 14:31 [PATCH 0/2] Notifications for perf sideband events Naveen N. Rao
2017-06-19 14:31 ` [PATCH 1/2] kernel/events: Add option to notify through signals on wakeup Naveen N. Rao
2017-07-12 11:46   ` Peter Zijlstra
2017-07-13 14:37     ` Naveen N. Rao
2017-06-19 14:31 ` [PATCH 2/2] kernel/events: Add option to enable counting sideband events in wakeup_events Naveen N. Rao
2017-07-12 10:48   ` Jiri Olsa [this message]
2017-07-13 14:34     ` Naveen N. Rao
2017-07-12 11:48   ` Peter Zijlstra
2017-07-13 14:55     ` Naveen N. Rao
2017-06-27  9:04 ` [PATCH 0/2] Notifications for perf sideband events Naveen N. Rao
2017-07-12 10:48 ` Jiri Olsa
2017-07-13 14:20   ` Naveen N. Rao
2017-07-13 15:35     ` Vince Weaver

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=20170712104855.GA3033@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=vincent.weaver@maine.edu \
    /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