mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/6] perf core: Read from overwrite ring buffer
@ 2016-01-22 12:13 Wang Nan
  2016-01-22 12:13 ` [PATCH 1/6] perf core: Introduce new ioctl options to pause and resume " Wang Nan
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Wang Nan @ 2016-01-22 12:13 UTC (permalink / raw)
  To: peterz, alexei.starovoitov, acme
  Cc: linux-kernel, Wang Nan, He Kuang, Alexei Starovoitov,
	Arnaldo Carvalho de Melo, Brendan Gregg, Jiri Olsa,
	Masami Hiramatsu, Namhyung Kim, Zefan Li, pi3orama

This is v2 of this series.

Compare with v1:

Fixes several bugs in v1.

Corresponsing perf has finished and can be found from:

 https://git.kernel.org/cgit/linux/kernel/git/pi3orama/linux.git/ 
 branch: perf/overwrite-benchmark

Some benchmarking results can be found from [1].

Summary:

On a PC with Intel E5-2640 0 @ 2.50GHz CPU, execute close(-1) 3000000
times, capture raw_syscalls:* with perf into overwrite ring buffer,
check total time (in us):

             MEAN           STDVAR
BASE     :  879870.81      11913.13
RAWPERF  : 2603854.7      706658.4
WRTBKWRD : 2313301.220      6727.957
TAILSIZE : 2383051.860      5248.061
RAWOVWRT : 2315273.180      5221.025
RAWOVWRT*: 2323970.45       5103.39 

Where:
BASE: don't use perf at all.
RAWPERF: use non-overwrite ring buffer, perf collects all data,
	 write to /dev/null
WRTBKWRD: Use backward writing ring buffer, write from tail to head,
          never wakeup perf, collect data when exiting.
TAILSIZE: Use tailsize ring buffer, pad 8 bytes for the size of the
          record for each event, never wakeup perf, collect data when
	  exiting.
RAWOVWRT: Use raw overwrite ring buffer, never wakeup perf, don't
          collect data at all.
RAWOVWRT*: Same as RAWOVWRT, without this patchset.

The benchmarking results shows WRTBKWRD is good enough. I suggest not
to implement TAILSIZE and tail-header ring buffer.

I will post the result on a smartphone next week.

[1] http://lkml.kernel.org/g/56A07FF3.2090009@huawei.com

Wang Nan (6):
  perf core: Introduce new ioctl options to pause and resume ring buffer
  perf core: Set event's default overflow_handler
  perf core: Prepare writing into ring buffer from end
  perf core: Add backward attribute to perf event
  perf core: Reduce perf event output overhead by setting overwrite
    handler
  perf core: Put size of a sample at the end of it by
    PERF_SAMPLE_TAILSIZE

 include/linux/perf_event.h      |  39 +++++++---
 include/uapi/linux/perf_event.h |   7 +-
 kernel/events/core.c            | 155 +++++++++++++++++++++++++++++++---------
 kernel/events/internal.h        |  11 +++
 kernel/events/ring_buffer.c     |  70 +++++++++++++++---
 5 files changed, 228 insertions(+), 54 deletions(-)

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
-- 
1.8.3.4

^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: [PATCH] perf core: Introduce new ioctl options to pause and resume ring buffer
@ 2016-01-18 12:02 Peter Zijlstra
  2016-01-19 11:16 ` [PATCH 0/6] perf core: Read from overwrite " Wang Nan
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Zijlstra @ 2016-01-18 12:02 UTC (permalink / raw)
  To: Wang Nan
  Cc: acme, linux-kernel, pi3orama, lizefan, He Kuang,
	Alexei Starovoitov, Arnaldo Carvalho de Melo, Brendan Gregg,
	David S. Miller, Jiri Olsa, Masami Hiramatsu, Namhyung Kim

On Mon, Jan 18, 2016 at 11:52:01AM +0000, Wang Nan wrote:

> +#define PERF_EVENT_IOC_PAUSE_OUTPUT	_IO ('$', 9)
> +#define PERF_EVENT_IOC_RESUME_OUTPUT	_IO ('$', 10)

Would not a single IOCTL with a 'boolean' parameter make more sense?

> +++ b/kernel/events/ring_buffer.c
> @@ -125,7 +125,7 @@ int perf_output_begin(struct perf_output_handle *handle,
>  	if (unlikely(!rb))
>  		goto out;
>  
> -	if (unlikely(!rb->nr_pages))
> +	if (unlikely(rb->paused))
>  		goto out;

Should we increment rb->lost in this case?

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-01-22 19:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-22 12:13 [PATCH 0/6] perf core: Read from overwrite ring buffer Wang Nan
2016-01-22 12:13 ` [PATCH 1/6] perf core: Introduce new ioctl options to pause and resume " Wang Nan
2016-01-22 19:36   ` Alexei Starovoitov
2016-01-22 12:13 ` [PATCH 2/6] perf core: Set event's default overflow_handler Wang Nan
2016-01-22 12:13 ` [PATCH 3/6] perf core: Prepare writing into ring buffer from end Wang Nan
2016-01-22 12:13 ` [PATCH 4/6] perf core: Add backward attribute to perf event Wang Nan
2016-01-22 12:13 ` [PATCH 5/6] perf core: Reduce perf event output overhead by setting overwrite handler Wang Nan
2016-01-22 12:13 ` [PATCH 6/6] perf core: Put size of a sample at the end of it by PERF_SAMPLE_TAILSIZE Wang Nan
2016-01-22 19:37 ` [PATCH 0/6] perf core: Read from overwrite ring buffer Alexei Starovoitov
  -- strict thread matches above, loose matches on Subject: below --
2016-01-18 12:02 [PATCH] perf core: Introduce new ioctl options to pause and resume " Peter Zijlstra
2016-01-19 11:16 ` [PATCH 0/6] perf core: Read from overwrite " Wang Nan
2016-01-19 11:16   ` [PATCH 1/6] perf core: Introduce new ioctl options to pause and resume " Wang Nan

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®