public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Stephane Eranian <eranian@googlemail.com>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, paulus@samba.org,
	perfmon2-devel@lists.sf.net, Stephane Eranian <eranian@gmail.com>
Subject: Re: [PATCH] perf_events: fix default watermark calculation
Date: Wed, 18 Nov 2009 15:35:25 +0100	[thread overview]
Message-ID: <1258554925.3918.504.camel@laptop> (raw)
In-Reply-To: <1256302576-6169-1-git-send-email-eranian@gmail.com>

On Fri, 2009-10-23 at 14:56 +0200, Stephane Eranian wrote:
> 	This patch fixes the default watermark value for
> 	the sampling buffer. With the existing calculation
> 	(watermark = max(PAGE_SIZE, max_size / 2)), no
> 	notification was ever received when the buffer was
> 	exactly 1 page. This was because you would never
> 	cross the threshold (there is no partial samples).

Right, silly thinko, thanks for catching this.

> 	In certain configuration, there was no possibilty
> 	detecting the problem because there was not enough
> 	space left to store the LOST record.In fact, there
> 	may be a more generic problem here. The kernel should
> 	ensure that there is alaways enough space to store
> 	one LOST record.

It tries to prepend LOST records for each new event (when there is data
lost), so as soon as it manages to write a new event, it will include a
LOST record when appropriate.

> 	This patch sets the default watermark to half the
> 	buffer size. With such limit, we are guaranteed to
> 	get a notification even with a single page buffer
> 	assuming no sample is bigger than a page.
> 	
> 	Signed-off-by: Stephane Eranian <eranian@gmail.com>

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>

> ---
>  kernel/perf_event.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/perf_event.c b/kernel/perf_event.c
> index a69d4ed..e8ec4b7 100644
> --- a/kernel/perf_event.c
> +++ b/kernel/perf_event.c
> @@ -2315,7 +2315,7 @@ perf_mmap_data_init(struct perf_event *event, struct perf_mmap_data *data)
>  	}
>  
>  	if (!data->watermark)
> -		data->watermark = max_t(long, PAGE_SIZE, max_size / 2);
> +		data->watermark = max_size / 2;
>  
> 
>  	rcu_assign_pointer(event->data, data);



  reply	other threads:[~2009-11-18 14:35 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-20 21:19 [PATCH 00/15] perf_event patches Peter Zijlstra
2009-11-20 21:19 ` [PATCH 01/15] perf: allow for custom overflow handlers Peter Zijlstra
2009-11-20 22:00   ` Frederic Weisbecker
2009-11-21 13:41   ` [tip:perf/core] perf: Allow " tip-bot for Peter Zijlstra
2009-11-20 21:19 ` [PATCH 02/15] perf: optimize some swcounter attr.sample_period==1 paths Peter Zijlstra
2009-11-21 13:41   ` [tip:perf/core] perf: Optimize " tip-bot for Peter Zijlstra
2009-11-20 21:19 ` [PATCH 03/15] perf: optimize perf_swevent_ctx_event() Peter Zijlstra
2009-11-21 13:41   ` [tip:perf/core] perf: Optimize perf_swevent_ctx_event() tip-bot for Peter Zijlstra
2009-11-23  5:50   ` [PATCH 03/15] perf: optimize perf_swevent_ctx_event() Paul Mackerras
2009-11-23  7:31     ` Peter Zijlstra
2009-11-23  8:38       ` Peter Zijlstra
2009-11-20 21:19 ` [PATCH 04/15] perf: optimize perf_event_task_ctx() Peter Zijlstra
2009-11-21 13:41   ` [tip:perf/core] perf: Optimize perf_event_task_ctx() tip-bot for Peter Zijlstra
2009-11-20 21:19 ` [PATCH 05/15] perf: optimize perf_event_comm_ctx() Peter Zijlstra
2009-11-21 13:41   ` [tip:perf/core] perf: Optimize perf_event_comm_ctx() tip-bot for Peter Zijlstra
2009-11-20 21:19 ` [PATCH 06/15] perf: optimize perf_event_mmap_ctx() Peter Zijlstra
2009-11-21 13:42   ` [tip:perf/core] perf: Optimize perf_event_mmap_ctx() tip-bot for Peter Zijlstra
2009-11-20 21:19 ` [PATCH 07/15] perf: Fix PERF_FORMAT_GROUP scale info Peter Zijlstra
2009-11-21 13:42   ` [tip:perf/core] " tip-bot for Peter Zijlstra
2009-11-20 21:19 ` [PATCH 08/15] perf: optimize perf_event_task_sched_out Peter Zijlstra
2009-11-21 13:42   ` [tip:perf/core] perf: Optimize perf_event_task_sched_out tip-bot for Peter Zijlstra
2009-11-20 21:19 ` [PATCH 09/15] perf: optimize __perf_event_read() Peter Zijlstra
2009-11-21 13:42   ` [tip:perf/core] perf: Optimize __perf_event_read() tip-bot for Peter Zijlstra
2009-11-20 21:19 ` [PATCH 10/15] perf: simplify __perf_event_sync_stat Peter Zijlstra
2009-11-21 13:43   ` [tip:perf/core] perf: Simplify __perf_event_sync_stat tip-bot for Peter Zijlstra
2009-11-20 21:19 ` [PATCH 11/15] perf: simplify __perf_event_read Peter Zijlstra
2009-11-21 13:43   ` [tip:perf/core] perf: Simplify __perf_event_read tip-bot for Peter Zijlstra
2009-11-20 21:19 ` [PATCH 12/15] perf: fix time locking Peter Zijlstra
2009-11-21 13:43   ` [tip:perf/core] perf: Fix " tip-bot for Peter Zijlstra
2009-11-20 21:19 ` [PATCH 13/15] perf: fix event scaling for inherited counters Peter Zijlstra
2009-11-21 13:43   ` [tip:perf/core] perf: Fix " tip-bot for Peter Zijlstra
2009-11-20 21:19 ` [PATCH 14/15] perf: fix locking for PERF_FORMAT_GROUP Peter Zijlstra
2009-11-21 13:44   ` [tip:perf/core] perf: Fix " tip-bot for Peter Zijlstra
2009-11-20 21:19 ` [PATCH 15/15] perf_events: fix default watermark calculation Peter Zijlstra
2009-10-23 12:56   ` [PATCH] " Stephane Eranian
2009-11-18 14:35     ` Peter Zijlstra [this message]
2009-11-21 13:44     ` [tip:perf/core] perf_events: Fix " tip-bot for Stephane Eranian
2009-11-23  5:52 ` [PATCH 00/15] perf_event patches Paul Mackerras

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=1258554925.3918.504.camel@laptop \
    --to=peterz@infradead.org \
    --cc=eranian@gmail.com \
    --cc=eranian@googlemail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=perfmon2-devel@lists.sf.net \
    /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