aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/perf_event.c
diff options
context:
space:
mode:
authorStephane Eranian <eranian@gmail.com>2009-11-20 16:19:57 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-21 08:11:41 -0500
commit8904b18046c2f050107f6449e887e7c1142b9ab9 (patch)
treec0a23af5059b60f3dd565e2a2a88c8737979588f /kernel/perf_event.c
parent6f10581aeaa5543a3b7a8c7a87a064375ec357f8 (diff)
perf_events: Fix default watermark calculation
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). 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. 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> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> LKML-Reference: <20091120212509.344964101@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu> LKML-Reference: <1256302576-6169-1-git-send-email-eranian@gmail.com>
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r--kernel/perf_event.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 3ede0981f4ac..718fa939b1a7 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -2340,7 +2340,7 @@ perf_mmap_data_init(struct perf_event *event, struct perf_mmap_data *data)
2340 } 2340 }
2341 2341
2342 if (!data->watermark) 2342 if (!data->watermark)
2343 data->watermark = max_t(long, PAGE_SIZE, max_size / 2); 2343 data->watermark = max_size / 2;
2344 2344
2345 2345
2346 rcu_assign_pointer(event->data, data); 2346 rcu_assign_pointer(event->data, data);