From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753262AbcEPDTm (ORCPT ); Sun, 15 May 2016 23:19:42 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:29131 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751895AbcEPDTl (ORCPT ); Sun, 15 May 2016 23:19:41 -0400 Subject: Re: [PATCH 08/17] perf record: Don't poll on overwrite channel To: Arnaldo Carvalho de Melo References: <1463126174-119290-1-git-send-email-wangnan0@huawei.com> <1463126174-119290-9-git-send-email-wangnan0@huawei.com> <20160513131209.GJ11346@kernel.org> CC: , , He Kuang , Arnaldo Carvalho de Melo , Jiri Olsa , Masami Hiramatsu , Namhyung Kim , Zefan Li , From: "Wangnan (F)" Message-ID: <57393C17.5070405@huawei.com> Date: Mon, 16 May 2016 11:18:47 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <20160513131209.GJ11346@kernel.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090205.57393C48.0019,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: d1d441137d61a6d94b082ff0714d1613 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/5/13 21:12, Arnaldo Carvalho de Melo wrote: > 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 >> Signed-off-by: He Kuang >> Cc: Arnaldo Carvalho de Melo >> Cc: Jiri Olsa >> Cc: Masami Hiramatsu >> Cc: Namhyung Kim >> Cc: Zefan Li >> 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 think the name 'system_wide' is more or less missleading. It is not means an event in 'perf record -a', but means "a selected event to be opened always without a pid when configured by perf_evsel__config().". See bf8e8f4b8. Here we use similary logic in existing perf_evlist__mmap_per_evsel. It never poll system_wide evsel: /* * The system_wide flag causes a selected event to be opened * always without a pid. Consequently it will never get a * POLLHUP, but it is used for tracking in combination with * other events, so it should not need to be polled anyway. * Therefore don't add it for polling. */ if (!evsel->system_wide && __perf_evlist__add_pollfd(evlist, fd, idx) < 0) { perf_evlist__mmap_put(evlist, idx); return -1; } Thank you.