Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934375AbeAKO03 (ORCPT + 1 other); Thu, 11 Jan 2018 09:26:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43558 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933911AbeAKO01 (ORCPT ); Thu, 11 Jan 2018 09:26:27 -0500 Date: Thu, 11 Jan 2018 15:26:17 +0100 From: Jiri Olsa To: kan.liang@intel.com Cc: acme@kernel.org, peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org, wangnan0@huawei.com, jolsa@kernel.org, namhyung@kernel.org, ak@linux.intel.com, yao.jin@linux.intel.com Subject: Re: [PATCH V3 11/12] perf top: switch default mode to overwrite mode Message-ID: <20180111142617.GG16655@krava> References: <1513879734-237492-1-git-send-email-kan.liang@intel.com> <1513879734-237492-12-git-send-email-kan.liang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1513879734-237492-12-git-send-email-kan.liang@intel.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 11 Jan 2018 14:26:27 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Thu, Dec 21, 2017 at 10:08:53AM -0800, kan.liang@intel.com wrote: > From: Kan Liang > > perf_top__mmap_read has severe performance issue in > Knights Landing/Mill, when monitoring in heavy load system. It costs > several minutes to finish, which is unacceptable. > > Currently, perf top is non overwrite mode. For non overwrite mode, it > tries to read everything in the ringbuffer and doesn't pause the > ringbuffer. Once there are lots of samples delivered persistently, > the processing time could be very long. Also, the latest samples could > be lost when the ringbuffer is full. > > For overwrite mode, it takes a snapshot for the system by pausing the > ringbuffer, which could significantly reducing the processing time. > Also, the overwrite mode always keep the latest samples. > Considering the real time requirement for perf top, the overwrite mode > is more suitable for perf top. > > Actually, perf top was overwrite mode. It is changed to non overwrite > mode since commit 93fc64f14472 ("perf top: Switch to non overwrite > mode"). It's better to change it back to overwrite mode by default. > > For the kernel which doesn't support overwrite mode, it will fall back > to non overwrite mode. > > There would be some records lost in overwrite mode because of pausing > the ringbuffer. It has little impact for the accuracy of the snapshot > and could be tolerant. > The lost events checking is removed. > > For overwrite mode, unconditionally wait 100 ms before each snapshot. It > also reduce the overhead caused by pausing ringbuffer, especially on > light load system. > > Signed-off-by: Kan Liang > --- > tools/perf/builtin-top.c | 44 ++++++++++++++++++++++++------------------ > tools/perf/ui/browsers/hists.c | 12 +++++++++--- > 2 files changed, 34 insertions(+), 22 deletions(-) > > diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c > index 8d19ef7..3c14333 100644 > --- a/tools/perf/builtin-top.c > +++ b/tools/perf/builtin-top.c > @@ -283,16 +283,6 @@ static void perf_top__print_sym_table(struct perf_top *top) > > printf("%-*.*s\n", win_width, win_width, graph_dotted_line); > > - if (hists->stats.nr_lost_warned != > - hists->stats.nr_events[PERF_RECORD_LOST]) { > - hists->stats.nr_lost_warned = > - hists->stats.nr_events[PERF_RECORD_LOST]; > - color_fprintf(stdout, PERF_COLOR_RED, > - "WARNING: LOST %d chunks, Check IO/CPU overload", > - hists->stats.nr_lost_warned); > - ++printed; > - } > - should this stay for non-overwrite mode? jirka