Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1400788
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 08/17] perf record: Don't poll on overwrite channel |
| Date | 2016-05-13 15:20 +0200 |
| Message-ID | <rylay-3Vi-19@gated-at.bofh.it> (permalink) |
| References | <rygaR-7tc-1@gated-at.bofh.it> <rygaS-7tc-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Em Fri, May 13, 2016 at 07:56:05AM +0000, Wang Nan escreveu:
> There's no need to receive events from overwritable ring buffer. Instead,
> perf should make them run background until something happen. This patch
> makes normal events from overwrite ring buffer ignored.
>
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> Signed-off-by: He Kuang <hekuang@huawei.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Zefan Li <lizefan@huawei.com>
> Cc: pi3orama@163.com
> ---
> tools/perf/util/evlist.c | 23 +++++++++++++++++++----
> 1 file changed, 19 insertions(+), 4 deletions(-)
>
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index abce588..f0b0457 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -461,9 +461,9 @@ int perf_evlist__alloc_pollfd(struct perf_evlist *evlist)
> return 0;
> }
>
> -static int __perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd, int idx)
> +static int __perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd, int idx, short revent)
> {
> - int pos = fdarray__add(&evlist->pollfd, fd, POLLIN | POLLERR | POLLHUP);
> + int pos = fdarray__add(&evlist->pollfd, fd, revent | POLLERR | POLLHUP);
> /*
> * Save the idx so that when we filter out fds POLLHUP'ed we can
> * close the associated evlist->mmap[] entry.
> @@ -479,7 +479,7 @@ static int __perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd, int idx
>
> int perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd)
> {
> - return __perf_evlist__add_pollfd(evlist, fd, -1);
> + return __perf_evlist__add_pollfd(evlist, fd, -1, POLLIN);
> }
>
> static void perf_evlist__munmap_filtered(struct fdarray *fda, int fd)
> @@ -1077,6 +1077,18 @@ perf_evlist__channel_complete(struct perf_evlist *evlist)
> return 0;
> }
>
> +static bool
> +perf_evlist__should_poll(struct perf_evlist *evlist,
> + struct perf_evsel *evsel,
> + int channel)
> +{
> + if (evsel->system_wide)
> + return false;
So, what is the above doing in this patch? If we should not poll when in
syswide mode, then this should be in a separate patch, unrelated to
'channels'. No?
I.e. it would be an improvement that would be cherry pickable right now,
even before reviewing the channel concept.
- Arnaldo
> + if (perf_evlist__channel_check(evlist, channel, RDONLY))
> + return false;
> + return true;
> +}
> +
> static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int _idx,
> struct mmap_params *mp, int cpu,
> int thread, int *outputs)
> @@ -1085,6 +1097,7 @@ static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int _idx,
>
> evlist__for_each(evlist, evsel) {
> int fd, channel, idx, err;
> + short revent = POLLIN;
>
> channel = perf_evlist__channel_find(evlist, evsel, false);
> if (channel < 0) {
> @@ -1114,6 +1127,8 @@ static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int _idx,
> perf_evlist__mmap_get(evlist, idx);
> }
>
> + if (!perf_evlist__should_poll(evlist, evsel, channel))
> + revent = 0;
> /*
> * The system_wide flag causes a selected event to be opened
> * always without a pid. Consequently it will never get a
> @@ -1122,7 +1137,7 @@ static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int _idx,
> * Therefore don't add it for polling.
> */
> if (!evsel->system_wide &&
> - __perf_evlist__add_pollfd(evlist, fd, idx) < 0) {
> + __perf_evlist__add_pollfd(evlist, fd, idx, revent) < 0) {
> perf_evlist__mmap_put(evlist, idx);
> return -1;
> }
> --
> 1.8.3.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/17] perf tools: Support overwritable ring buffer Wang Nan <wangnan0@huawei.com> - 2016-05-13 10:00 +0200
[PATCH 15/17] perf record: Read from backward ring buffer Wang Nan <wangnan0@huawei.com> - 2016-05-13 10:00 +0200
[PATCH 01/17] perf tools: Extract __perf_evlist__mmap_read() Wang Nan <wangnan0@huawei.com> - 2016-05-13 10:00 +0200
Re: [PATCH 01/17] perf tools: Extract __perf_evlist__mmap_read() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-13 15:10 +0200
[PATCH 09/17] perf tools: Detect avalibility of write_backward Wang Nan <wangnan0@huawei.com> - 2016-05-13 10:00 +0200
Re: [PATCH 09/17] perf tools: Detect avalibility of write_backward Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-13 15:10 +0200
Re: [PATCH 09/17] perf tools: Detect avalibility of write_backward "Wangnan (F)" <wangnan0@huawei.com> - 2016-05-20 17:40 +0200
Re: [PATCH 09/17] perf tools: Detect avalibility of write_backward Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-20 17:40 +0200
[PATCH 05/17] perf record: Prevent reading invalid data in record__mmap_read Wang Nan <wangnan0@huawei.com> - 2016-05-13 10:00 +0200
[PATCH 17/17] perf tools: Don't warn about out of order event if write_backward is used Wang Nan <wangnan0@huawei.com> - 2016-05-13 10:00 +0200
[PATCH 11/17] perf tools: Set write_backward attribut bit for overwrite events Wang Nan <wangnan0@huawei.com> - 2016-05-13 10:00 +0200
[PATCH 04/17] perf tools: Operate multiple channels Wang Nan <wangnan0@huawei.com> - 2016-05-13 10:00 +0200
[PATCH 08/17] perf record: Don't poll on overwrite channel Wang Nan <wangnan0@huawei.com> - 2016-05-13 10:00 +0200
Re: [PATCH 08/17] perf record: Don't poll on overwrite channel Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-13 15:20 +0200
Re: [PATCH 08/17] perf record: Don't poll on overwrite channel "Wangnan (F)" <wangnan0@huawei.com> - 2016-05-16 05:20 +0200
[PATCH 16/17] perf record: Toggle overwrite ring buffer for reading Wang Nan <wangnan0@huawei.com> - 2016-05-13 10:00 +0200
[PATCH 10/17] perf tools: Enable overwrite settings Wang Nan <wangnan0@huawei.com> - 2016-05-13 10:00 +0200
Re: [PATCH 10/17] perf tools: Enable overwrite settings Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-16 15:40 +0200
[PATCH 07/17] perf record: Don't read from and poll overwrite channel Wang Nan <wangnan0@huawei.com> - 2016-05-13 10:00 +0200
[PATCH 12/17] perf tools: Record fd into perf_mmap Wang Nan <wangnan0@huawei.com> - 2016-05-13 10:00 +0200
[PATCH 13/17] perf tools: Add API to pause a channel Wang Nan <wangnan0@huawei.com> - 2016-05-13 10:00 +0200
[PATCH 14/17] perf record: Rename variable to make code clear Wang Nan <wangnan0@huawei.com> - 2016-05-13 10:10 +0200
[PATCH 02/17] perf tools: Add evlist channel helpers Wang Nan <wangnan0@huawei.com> - 2016-05-13 10:10 +0200
Re: [PATCH 02/17] perf tools: Add evlist channel helpers Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-13 15:10 +0200
Re: [PATCH 02/17] perf tools: Add evlist channel helpers "Wangnan (F)" <wangnan0@huawei.com> - 2016-05-18 05:40 +0200
Re: [PATCH 02/17] perf tools: Add evlist channel helpers Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com> - 2016-05-18 15:30 +0200
[PATCH 03/17] perf tools: Automatically add new channel according to evlist Wang Nan <wangnan0@huawei.com> - 2016-05-13 10:20 +0200
[PATCH 06/17] perf tools: Squash overwrite setting into channel Wang Nan <wangnan0@huawei.com> - 2016-05-13 10:20 +0200
csiph-web