mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Vince Weaver <vincent.weaver@maine.edu>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] kernel/events: Add option to enable counting sideband events in wakeup_events
Date: Fri, 4 Aug 2017 12:59:22 +0200	[thread overview]
Message-ID: <20170804105922.uaxuj3ote263ofec@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <3e7dabc8a4762aad3836244661f843dda689588b.1501576497.git.naveen.n.rao@linux.vnet.ibm.com>

On Tue, Aug 01, 2017 at 08:14:04PM +0530, Naveen N. Rao wrote:
> @@ -5974,19 +5976,8 @@ void perf_output_sample(struct perf_output_handle *handle,
>  		}
>  	}
>  
> +	if (!event->attr.count_sb_events)
> +		rb_handle_wakeup_events(event, handle->rb);
>  }

> +void __always_inline
> +rb_handle_wakeup_events(struct perf_event *event, struct ring_buffer *rb)
> +{
> +	int wakeup_events = event->attr.wakeup_events;
> +
> +	if (!event->attr.watermark && wakeup_events) {
> +		int events = local_inc_return(&rb->events);
> +
> +		if (events >= wakeup_events) {
> +			local_sub(wakeup_events, &rb->events);
> +			local_inc(&rb->wakeup);
> +		}
> +	}
> +}
> +
>  static int __always_inline
>  __perf_output_begin(struct perf_output_handle *handle,
>  		    struct perf_event *event, unsigned int size,
> @@ -197,6 +212,9 @@ __perf_output_begin(struct perf_output_handle *handle,
>  	 * none of the data stores below can be lifted up by the compiler.
>  	 */
>  
> +	if (unlikely(event->attr.count_sb_events))
> +		rb_handle_wakeup_events(event, rb);
> +
>  	if (unlikely(head - local_read(&rb->wakeup) > rb->watermark))
>  		local_add(rb->watermark, &rb->wakeup);
>  

I'm still slightly uneasy over this.. Yes most of our events are
samples, so we'd pay the overhead already. But could you still look at
performance of this, see for example this commit:

  9ecda41acb97 ("perf/core: Add ::write_backward attribute to perf event")

we went through a lot of variants to not hurt performance.

  reply	other threads:[~2017-08-04 10:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01 14:44 [PATCH v2 0/2] Notifications for perf sideband events Naveen N. Rao
2017-08-01 14:44 ` [PATCH v2 1/2] kernel/events: Add option to notify through signals on wakeup Naveen N. Rao
2017-08-03 17:57   ` Vince Weaver
2017-08-04  8:07     ` Naveen N. Rao
2017-08-04 10:20   ` Peter Zijlstra
2017-08-04 17:30     ` Naveen N. Rao
2017-08-01 14:44 ` [PATCH v2 2/2] kernel/events: Add option to enable counting sideband events in wakeup_events Naveen N. Rao
2017-08-04 10:59   ` Peter Zijlstra [this message]
2017-08-04 18:13     ` Naveen N. Rao

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=20170804105922.uaxuj3ote263ofec@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --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

all inboxes | Powered by JetHome®