Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934154AbeAKOZy (ORCPT + 1 other); Thu, 11 Jan 2018 09:25:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48590 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933486AbeAKOZv (ORCPT ); Thu, 11 Jan 2018 09:25:51 -0500 Date: Thu, 11 Jan 2018 15:25:41 +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 04/12] perf mmap: introduce perf_mmap__read_done Message-ID: <20180111142541.GC16655@krava> References: <1513879734-237492-1-git-send-email-kan.liang@intel.com> <1513879734-237492-5-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-5-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.27]); Thu, 11 Jan 2018 14:25:51 +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: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. > > It will be used later. > > Signed-off-by: Kan Liang > --- > tools/perf/util/mmap.c | 11 +++++++++++ > tools/perf/util/mmap.h | 1 + > 2 files changed, 12 insertions(+) > > diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c > index a844a2f..4aaeb64 100644 > --- a/tools/perf/util/mmap.c > +++ b/tools/perf/util/mmap.c > @@ -343,3 +343,14 @@ int perf_mmap__push(struct perf_mmap *md, bool overwrite, > out: > return rc; > } > + > +/* > + * Mandatory for overwrite mode > + * The direction of overwrite mode is backward. > + * The last mmap__read_event will set tail to map->prev. you mean perf_mmap__read function in this comment, right? jirka > + * Need to correct the map->prev to head which is the end of next read. > + */ > +void perf_mmap__read_done(struct perf_mmap *map) > +{ > + map->prev = perf_mmap__read_head(map); > +} > diff --git a/tools/perf/util/mmap.h b/tools/perf/util/mmap.h > index abe9b9f..2df27c1 100644 > --- a/tools/perf/util/mmap.h > +++ b/tools/perf/util/mmap.h > @@ -96,4 +96,5 @@ size_t perf_mmap__mmap_len(struct perf_mmap *map); > > int perf_mmap__read_init(struct perf_mmap *map, bool overwrite, > u64 *start, u64 *end); > +void perf_mmap__read_done(struct perf_mmap *map); > #endif /*__PERF_MMAP_H */ > -- > 2.5.5 >