Received: by 10.223.176.46 with SMTP id f43csp35799wra; Thu, 18 Jan 2018 13:32:46 -0800 (PST) X-Google-Smtp-Source: ACJfBotCtg4GII+mGCcOL5b+4Nea+se3VqTbqdGFKRs0R2ugJ78fWEHx0R87y+UX4WMHbD7tUr6t X-Received: by 10.98.202.84 with SMTP id n81mr17055214pfg.226.1516311166548; Thu, 18 Jan 2018 13:32:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516311166; cv=none; d=google.com; s=arc-20160816; b=ru4ZKcrwyBOHEdgUvp73aqIUbzP/aBxlMAvysHaKVWntEdieXfrsnX8pOIvM6FOH3Y myobERhMGQ5+QkUJR+OhgrW1st/Tj3Y7/A21pkP805o9z/NauK4DmzDJIBhpawArxQjm H1U7IR3EB5njJJC1F8598/yWxK9rQwtlTj0fcpiQUgDOqHA/bx4ofvJIqUCmeKqGYcfR 9iPgbPc3+Vy31fs/RvmTa4c49X2/QZ3SZL2rhctbwkh6SJ9Pj+R1eI9N2wRfTSzWf3OU KGi35RlTLfl3Psl6QHjnay3W9szhAnEYSxPXOqQ8vnBlDRR5MMGyGwDfMyu1Qh10weOW WGuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=1FNmQrXQ8gq0k1Lz0MVvz2vFXu7Tm47HhmuU1+Zdz1U=; b=zFpOvKAWIFep34hG3USAM/YTlhdndJ9d2g25y8BCLgF6CVnCJFzCA8rp+R6myCuPvE R4pQI6mYJx5RK0qMVPOR28j2/xbcuiTR67y1t0fzDhSajYM6pu1EfLG32HMvedUq56Gd 3bSl5pF/tMyEYwbQRPX55SBKAK/DTiyXeweHdlKpwsV7QIEKpuo9V5532wzRGDe0gEW6 daqvitxI087fhMm8hawjm+fZGnlaGSHc80bt+OJaqgyE/HfJ83VJ2X2zzcsR2zKqbwGE itaCRAKwkrpARur86xMkKK771z4ntqLxb1yAMOyLJcESeBztJQ7OqFUFuSBWvBMcf4Fj 2oZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34-v6si218473plc.650.2018.01.18.13.32.32; Thu, 18 Jan 2018 13:32:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755012AbeARVbb (ORCPT + 99 others); Thu, 18 Jan 2018 16:31:31 -0500 Received: from mga04.intel.com ([192.55.52.120]:47421 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753799AbeARV1f (ORCPT ); Thu, 18 Jan 2018 16:27:35 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jan 2018 13:27:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,378,1511856000"; d="scan'208";a="11477247" Received: from otc-knm-01.jf.intel.com ([10.54.39.34]) by fmsmga008.fm.intel.com with ESMTP; 18 Jan 2018 13:27:33 -0800 From: kan.liang@intel.com To: acme@kernel.org, peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: wangnan0@huawei.com, jolsa@kernel.org, namhyung@kernel.org, ak@linux.intel.com, yao.jin@linux.intel.com, Kan Liang Subject: [PATCH V5 07/17] perf mmap: introduce perf_mmap__read_done Date: Thu, 18 Jan 2018 13:26:22 -0800 Message-Id: <1516310792-208685-8-git-send-email-kan.liang@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1516310792-208685-1-git-send-email-kan.liang@intel.com> References: <1516310792-208685-1-git-send-email-kan.liang@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kan Liang The direction of overwrite mode is backward. The last perf_mmap__read() 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 125bfda..4f59eae 100644 --- a/tools/perf/util/mmap.c +++ b/tools/perf/util/mmap.c @@ -338,3 +338,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 perf_mmap__read() will set tail to map->prev. + * 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 9ab2b48..95549d4 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 *md, bool overwrite, u64 *startp, u64 *endp); +void perf_mmap__read_done(struct perf_mmap *map); #endif /*__PERF_MMAP_H */ -- 2.5.5