Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752076AbeADCtj (ORCPT + 1 other); Wed, 3 Jan 2018 21:49:39 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:36578 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751987AbeADCti (ORCPT ); Wed, 3 Jan 2018 21:49:38 -0500 X-Google-Smtp-Source: ACJfBovSHnT1r6k4QHRDG4AaNhC8ppUviYnO7vslHN6zOV2IRX7sBiGycx2jOmXPhuRdbTdmgV+Sng== Date: Thu, 4 Jan 2018 11:46:43 +0900 From: Namhyung Kim To: "Liang, Kan" Cc: "acme@kernel.org" , "peterz@infradead.org" , "mingo@redhat.com" , "linux-kernel@vger.kernel.org" , "wangnan0@huawei.com" , "jolsa@kernel.org" , "ak@linux.intel.com" , "yao.jin@linux.intel.com" , "kernel-team@lge.com" Subject: Re: [PATCH V3 04/12] perf mmap: introduce perf_mmap__read_done Message-ID: <20180104024643.GA1400@danjae.aot.lge.com> References: <1513879734-237492-1-git-send-email-kan.liang@intel.com> <1513879734-237492-5-git-send-email-kan.liang@intel.com> <20180102073343.GA8810@sejong> <37D7C6CF3E00A74B8858931C1DB2F077537FBC61@SHSMSX103.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <37D7C6CF3E00A74B8858931C1DB2F077537FBC61@SHSMSX103.ccr.corp.intel.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Hi Kan, On Wed, Jan 03, 2018 at 02:15:38PM +0000, Liang, Kan wrote: > > Hello, > > > > On Thu, Dec 21, 2017 at 10:08:46AM -0800, kan.liang@intel.com wrote: > > > From: Kan Liang > > > > > > The direction of overwrite mode is backward. The last mmap__read_event > > > will set tail to map->prev. Need to correct the map->prev to head > > > which is the end of next read. > > > > Why do you update the map->prev needlessly then? I think we don't need it > > for overwrite/backward mode, right? > > The map->prev is needless only when the overwrite does really happen in ringbuffer. > In a light load system or with big ringbuffer, the unprocessed data will not be > overwritten. So it's necessary to keep an pointer to indicate the last position. > > Overwrite mode is backward, but the event processing is always forward. > So map->prev has to be updated in __read_done(). Yep, I meant that updating map->prev in every perf_mmap__read_event() is unnecessary for the overwrite mode. It only needs to be set in perf_mmap__read_done(), right? > > > > > Also I guess the current code might miss some events since the head can be > > different between _read_init() and _read_done(), no? > > > > The overwrite mode requires the ring buffer to be paused during processing. > The head is unchanged between __read_init() and __read_done(). Ah, ok then. Maybe we could read the head once, and use it during processing. Thanks, Namhyung > > The event during the pause should be missed. But I think it has little impact for > the accuracy of the snapshot and can be tolerant for perf top. > I mentioned it in the change log of patch 11/12. > I also removed the lost events checking for perf top.