Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1685719 > unrolled thread

Re: [PATCH 2/2] kernel/events: Add option to enable counting sideband events in wakeup_events

Started byPeter Zijlstra <peterz@infradead.org>
First post2017-07-12 13:50 +0200
Last post2017-07-13 17:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 2/2] kernel/events: Add option to enable counting  sideband events in wakeup_events Peter Zijlstra <peterz@infradead.org> - 2017-07-12 13:50 +0200
    Re: [PATCH 2/2] kernel/events: Add option to enable counting  sideband events in wakeup_events "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-07-13 17:00 +0200

#1685719 — Re: [PATCH 2/2] kernel/events: Add option to enable counting sideband events in wakeup_events

FromPeter Zijlstra <peterz@infradead.org>
Date2017-07-12 13:50 +0200
SubjectRe: [PATCH 2/2] kernel/events: Add option to enable counting sideband events in wakeup_events
Message-ID<u2ojv-7Jo-5@gated-at.bofh.it>
On Mon, Jun 19, 2017 at 08:01:08PM +0530, Naveen N. Rao wrote:
> 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);
> +			}
> +		}
> +	}
> +
>  	if (unlikely(head - local_read(&rb->wakeup) > rb->watermark))
>  		local_add(rb->watermark, &rb->wakeup);
>  

So this is a very performance sensitive function; not at all happy to
add bits here ... :/

[toc] | [next] | [standalone]


#1686598

From"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Date2017-07-13 17:00 +0200
Message-ID<u2NKW-6Wd-9@gated-at.bofh.it>
In reply to#1685719
On 2017/07/12 01:48PM, Peter Zijlstra wrote:
> On Mon, Jun 19, 2017 at 08:01:08PM +0530, Naveen N. Rao wrote:
> > 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);
> > +			}
> > +		}
> > +	}
> > +
> >  	if (unlikely(head - local_read(&rb->wakeup) > rb->watermark))
> >  		local_add(rb->watermark, &rb->wakeup);
> >  
> 
> So this is a very performance sensitive function; not at all happy to
> add bits here ... :/

:O

Does it at all help if the above is instead guarded by:
	if (unlikely(event->attr.count_sb_events)) {
		...
	}

That should hopefully limit the impact to only when that option is used?


Thanks,
Naveen

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web