Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4116034pxu; Mon, 12 Oct 2020 09:51:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydx+5o5aHxq09DCiSWVDrIjc+dp93pexpzre/3l+CwrO/Mf0j2A/ds0n3TdRIMgKp8OaW+ X-Received: by 2002:a50:ec8e:: with SMTP id e14mr15037489edr.98.1602521503350; Mon, 12 Oct 2020 09:51:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602521503; cv=none; d=google.com; s=arc-20160816; b=XJJkDoSaDtKNXSXRjOIGOhwi9QTDYEpG0KUmhEDeNgH1mifMohi0/nsr7hOGNt1vmO xQDvtwLLxR3DsLWJQ5nO0lPYgSfidcsy5v6LXJjkJTnYUCxGfU9ffgncMTmxyTgsKyZl kczVAJT/spo3lYPg53+8ocGbH5nQpQub8LChASRheva+nEUQ0/N7sUGKrAmgsG9w9NYv a3D2dNDfI8Hu1Tlz/Tr7rtkcZCy6FQ4n/zFWvH9MzQ9RGYtV2s5vD1blu7NlNGsBI8mX fiErTb5ZBZ4UyUovgxMcShbbPQ9wctj6PWLYUNGvgL4fxgdjrGDZRitQKyu8aBXCAE7f UCXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=+fMtvE9jKdFRiKSuD99tu6iB9iT+MMRmXaRPqzGixEg=; b=DDSG9emTh9o51X0MbjKPM92H6p6PtqEC7dhloo7JMYo/5Q4Hbiz5wWit5x10fsohYw mHdXJfV/BR+lvxQEINvk0xLYJxKLM6qz/iLnbdxRtwz4hbgrVEGIrwuGqHcg8XHXPSxV Xy/cT2CCJj+ikEOAQYW8hMl/xtOHzWOYZJ6qsL4fQD1a7FevTzSmurBY9sgTyd9jG3s2 lTI1PikT4iH2lTXY5LoyQIxq7RPxb1JMGx/P2Yem0fbcL16i7g6mYnz1dTAYwZo1seGW DJ9FFzVF6TW5Uy1UK3lOjoJ+AonAHcAaV+tZF4Z8+OQIDFzzP5tw9vnBacic5SoqERuc s9Tg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h25si8407915edt.103.2020.10.12.09.51.20; Mon, 12 Oct 2020 09:51:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390676AbgJLQtf (ORCPT + 99 others); Mon, 12 Oct 2020 12:49:35 -0400 Received: from mga01.intel.com ([192.55.52.88]:30130 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726742AbgJLQte (ORCPT ); Mon, 12 Oct 2020 12:49:34 -0400 IronPort-SDR: rO4tLdlc35XpFS4ZFK0YbJ55cvfu2A7Chs4l+uKMpLKaIyvGv38Hq2wJGZ/MzJMOM03EeJdq0h 8Rhr11GP11Ig== X-IronPort-AV: E=McAfee;i="6000,8403,9772"; a="183233594" X-IronPort-AV: E=Sophos;i="5.77,367,1596524400"; d="scan'208";a="183233594" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2020 09:49:30 -0700 IronPort-SDR: TTDIWA5/zh8RhdtXwCpiBYl8Dif6BuGBE75srLyiRrn52YU8NCg8b2YGIN7eXz6W8QuzTnA3GA WM3pfDC7wMWw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,367,1596524400"; d="scan'208";a="390000775" Received: from linux.intel.com ([10.54.29.200]) by orsmga001.jf.intel.com with ESMTP; 12 Oct 2020 09:49:30 -0700 Received: from [10.249.225.186] (abudanko-mobl.ccr.corp.intel.com [10.249.225.186]) by linux.intel.com (Postfix) with ESMTP id F18CC58084F; Mon, 12 Oct 2020 09:49:24 -0700 (PDT) Subject: Re: [PATCH v1 06/15] perf session: load data directory into tool process memory To: Andi Kleen Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim , Alexander Shishkin , Adrian Hunter , Peter Zijlstra , Ingo Molnar , linux-kernel References: <810f3a69-0004-9dff-a911-b7ff97220ae0@linux.intel.com> <39cf6164-f3be-ae34-292a-94faef32fdb9@linux.intel.com> <20201012160921.GD466880@tassilo.jf.intel.com> From: Alexey Budankov Organization: Intel Corp. Message-ID: <8f90c785-8bdc-e7cd-a6d9-7eed0fb2c6b3@linux.intel.com> Date: Mon, 12 Oct 2020 19:49:22 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <20201012160921.GD466880@tassilo.jf.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12.10.2020 19:09, Andi Kleen wrote: > On Mon, Oct 12, 2020 at 11:58:58AM +0300, Alexey Budankov wrote: >> >> Read trace files located at data directory into tool process memory. >> Basic analysis support of data directories is provided for report >> mode. Raw dump (-D) and aggregated reports are available for data >> directories, still with no memory consumption optimizations. However >> data directories collected with --compression-level option enabled >> can be analyzed with little less memory because trace files are >> unmaped from tool process memory after loading collected data. >> The implementation is based on the prototype [1], [2]. > > Should credit the author(s) of the prototypes. Sure. Will explicitly add: Suggested-by: Jiri Olsa Suggested-by: Namhyung Kim here and [PATCH v2 15/15], additionally to [1], [2] below. Thanks for pointing this out! >> >> [1] git clone https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git -b perf/record_threads >> [2] https://lore.kernel.org/lkml/20180913125450.21342-1-jolsa@kernel.org/ >> >> Signed-off-by: Alexey Budankov >> --- >> tools/perf/util/session.c | 48 +++++++++++++++++++++++++++++++++++++++ >> tools/perf/util/session.h | 1 + >> 2 files changed, 49 insertions(+) >> >> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c >> index 6afc670fdf0c..0752eec19813 100644 >> --- a/tools/perf/util/session.c >> +++ b/tools/perf/util/session.c >> @@ -2212,6 +2212,17 @@ reader__process_events(struct reader *rd, struct perf_session *session, >> goto more; >> >> out: >> + if (rd->unmap_file) { >> + int i; >> + >> + for (i = 0; i < NUM_MMAPS; i++) { >> + if (mmaps[i]) { >> + munmap(mmaps[i], mmap_size); >> + mmaps[i] = NULL; > > Okay so where is the mmap? Would make more sense to put that > into the same patch as who adds the mmap. Or is the mmap > code already in the perf source? In that case it should > probably be some common helper with the existing users. That mmap is already in the code. Agree, this part of the patch can be applied prior the whole patch set. Alexei