Re: [PATCH 03/16] perf, persistent: Setting default buffer size to 512k as in perf tools

2013-05-31 Thread Borislav Petkov
On Fri, May 31, 2013 at 10:47:23AM +0200, Robert Richter wrote:
> From: Robert Richter 
> 
> The default buffer size used to setup event buffers with perf tools is
> 512k. Using the same buffer size for persistent events. This also
> avoids failed mmap calls due to different buffer sizes.
> 
> Signed-off-by: Robert Richter 
> ---
>  kernel/events/persistent.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/events/persistent.c b/kernel/events/persistent.c
> index 9075164..1e6c03a 100644
> --- a/kernel/events/persistent.c
> +++ b/kernel/events/persistent.c
> @@ -5,6 +5,9 @@
>  
>  #include "internal.h"
>  
> +/* 512 kiB: default perf tools memory size, see perf_evlist__mmap() */
> +#define CPU_BUFFER_NR_PAGES  ((512 * 1024) / PAGE_SIZE)
> +
>  static DEFINE_PER_CPU(struct list_head, pers_events);
>  
>  static struct perf_event *
> @@ -151,7 +154,7 @@ int perf_add_persistent_event_by_id(int id)
>   attr->type  = PERF_TYPE_TRACEPOINT;
>   attr->size  = sizeof(*attr);
>  
> - return perf_add_persistent_event(attr, 4);
> + return perf_add_persistent_event(attr, CPU_BUFFER_NR_PAGES);

This one too - the 4 pages I chose then was purely arbitrary for I had
no idea what size to pick. This clearly makes more sense.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/16] perf, persistent: Setting default buffer size to 512k as in perf tools

2013-05-31 Thread Robert Richter
From: Robert Richter 

The default buffer size used to setup event buffers with perf tools is
512k. Using the same buffer size for persistent events. This also
avoids failed mmap calls due to different buffer sizes.

Signed-off-by: Robert Richter 
---
 kernel/events/persistent.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/events/persistent.c b/kernel/events/persistent.c
index 9075164..1e6c03a 100644
--- a/kernel/events/persistent.c
+++ b/kernel/events/persistent.c
@@ -5,6 +5,9 @@
 
 #include "internal.h"
 
+/* 512 kiB: default perf tools memory size, see perf_evlist__mmap() */
+#define CPU_BUFFER_NR_PAGES((512 * 1024) / PAGE_SIZE)
+
 static DEFINE_PER_CPU(struct list_head, pers_events);
 
 static struct perf_event *
@@ -151,7 +154,7 @@ int perf_add_persistent_event_by_id(int id)
attr->type  = PERF_TYPE_TRACEPOINT;
attr->size  = sizeof(*attr);
 
-   return perf_add_persistent_event(attr, 4);
+   return perf_add_persistent_event(attr, CPU_BUFFER_NR_PAGES);
 }
 
 int perf_get_persistent_event_fd(unsigned cpu, struct perf_event_attr *attr)
-- 
1.8.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/