From: Adrian Hunter <adrian.hunter@intel.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>,
linux-kernel@vger.kernel.org, David Ahern <dsahern@gmail.com>,
Don Zickus <dzickus@redhat.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Mike Galbraith <efault@gmx.de>,
Namhyung Kim <namhyung@kernel.org>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <peterz@infradead.org>,
Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 04/10] perf record: Filter out POLLHUP'ed file descriptors
Date: Fri, 05 Sep 2014 11:42:59 +0300 [thread overview]
Message-ID: <54097793.4050201@intel.com> (raw)
In-Reply-To: <20140904151902.GE2997@kernel.org>
On 09/04/2014 06:19 PM, Arnaldo Carvalho de Melo wrote:
> Em Thu, Sep 04, 2014 at 03:32:08PM +0300, Adrian Hunter escreveu:
>> On 09/04/2014 12:59 AM, Arnaldo Carvalho de Melo wrote:
>>> So that we don't continue polling on vanished file descriptors, i.e.
>>> file descriptors for events monitoring threads that exited.
>
>>> I.e. the following 'perf record' command now exits as expected, instead
>>> of staying in an eternal loop:
>
>>> $ sleep 5s &
>>> $ perf record -p `pidof sleep`
>
>>> Reported-by: Jiri Olsa <jolsa@redhat.com>
> <SNIP>
>>> +++ b/tools/perf/builtin-record.c
>>> @@ -467,6 +467,9 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
>>> if (err > 0 || (err < 0 && errno == EINTR))
>>> err = 0;
>>> waking++;
>>> + if (perf_evlist__filter_pollfd(rec->evlist, POLLERR | POLLHUP) == 0)
>>
>> If the poll fds only include the ones mmapped, then mightn't it filter out
>> ones still in use? e.g. what if you record two processes and one exits?
>
> Humm, without looking at the code, we would be needlessly looking at the
> mmaps for the threads that exited.
>
> I.e. we need to associate at the fdarray level the mmaps for the
> descriptors, so that we can, at fdarray__filter() time, munmap the
> POLLHUPed descriptors, right?
>
> I'll take a look at the code to see what is needed.
>
> But then this makes the patch set good for a class of problems while
> maintaining existing behaviour for the case you outlined, i.e. this is a
> partial fix and should go now, with further patches on top of it?
No I was meaning something different. For example, 'perf record' opens an
event for 2 processes per-cpu and gets 4 file descriptors:
task1 task2
cpu0 fd0 fd1
cpu1 fd2 fd3
Now, perf record will mmap fd0 and fd2 and set-output fd1->fd0
and fd3->fd2.
pollfds includes only fd0 and fd2.
But if task2 exits, the POLLHUP will appear on fd1 and fd3.
I think Jiri's patchset changed pollfds to include all fds for that reason.
next prev parent reply other threads:[~2014-09-05 8:44 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-03 21:59 [RFC 00/10] perf pollfd series v2 Arnaldo Carvalho de Melo
2014-09-03 21:59 ` [PATCH 01/10] perf evlist: Introduce perf_evlist__filter_pollfd method Arnaldo Carvalho de Melo
2014-09-03 21:59 ` [PATCH 02/10] perf tests: Add test for perf_evlist__filter_pollfd() Arnaldo Carvalho de Melo
2014-09-03 21:59 ` [PATCH 03/10] perf evlist: Monitor POLLERR and POLLHUP events too Arnaldo Carvalho de Melo
2014-09-03 21:59 ` [PATCH 04/10] perf record: Filter out POLLHUP'ed file descriptors Arnaldo Carvalho de Melo
2014-09-04 12:32 ` Adrian Hunter
2014-09-04 15:19 ` Arnaldo Carvalho de Melo
2014-09-05 8:42 ` Adrian Hunter [this message]
2014-09-05 14:07 ` Arnaldo Carvalho de Melo
2014-09-06 20:39 ` Jiri Olsa
2014-09-08 13:46 ` Arnaldo Carvalho de Melo
2014-09-08 14:04 ` Jiri Olsa
2014-09-08 14:33 ` Arnaldo Carvalho de Melo
2014-09-08 15:10 ` Jiri Olsa
2014-09-08 15:38 ` Arnaldo Carvalho de Melo
2014-09-08 17:07 ` Arnaldo Carvalho de Melo
2014-09-26 9:21 ` [tip:perf/core] perf evlist: Refcount mmaps tip-bot for Arnaldo Carvalho de Melo
2014-09-26 9:20 ` [tip:perf/core] perf evlist: We need to poll all event file descriptors tip-bot for Arnaldo Carvalho de Melo
2014-09-03 21:59 ` [PATCH 05/10] perf trace: Filter out POLLHUP'ed " Arnaldo Carvalho de Melo
2014-09-03 22:00 ` [PATCH 06/10] perf evlist: Allow growing pollfd on add method Arnaldo Carvalho de Melo
2014-09-03 22:00 ` [PATCH 07/10] perf tests: Add pollfd growing test Arnaldo Carvalho de Melo
2014-09-03 22:00 ` [PATCH 08/10] perf kvm stat live: Use perf_evlist__add_pollfd() instead of local equivalent Arnaldo Carvalho de Melo
2014-09-03 22:00 ` [PATCH 09/10] perf evlist: Introduce poll method for common code idiom Arnaldo Carvalho de Melo
2014-09-03 22:00 ` [PATCH 10/10] tools lib api: Adopt fdarray class from perf's evlist Arnaldo Carvalho de Melo
-- strict thread matches above, loose matches on Subject: below --
2014-08-22 20:59 [RFC 00/10] perf pollfd series Arnaldo Carvalho de Melo
2014-08-22 20:59 ` [PATCH 04/10] perf record: Filter out POLLHUP'ed file descriptors Arnaldo Carvalho de Melo
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=54097793.4050201@intel.com \
--to=adrian.hunter@intel.com \
--cc=acme@kernel.org \
--cc=dsahern@gmail.com \
--cc=dzickus@redhat.com \
--cc=efault@gmx.de \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
/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
Powered by JetHome