Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp811669pxv; Thu, 1 Jul 2021 09:45:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCyX/p54D8JhrlXVN4f/s3lsg4EiXweLTOpluzbNlu0EuKlnDoRq7ZyPlUWM+hYU30C7eO X-Received: by 2002:a05:6638:9a:: with SMTP id v26mr691591jao.124.1625157921089; Thu, 01 Jul 2021 09:45:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625157921; cv=none; d=google.com; s=arc-20160816; b=Uvo2R1AAIbLFxOYAPFR4ng7pYLGeNE2YtnviFFoXUQl9k3HIgqJwAl1+J26Pv4POtK 6uSYl6041INRXlkdtOX1QG6BPPSU4EuuL5s9beUaSJEif/8PNbGivJ9JuK+s3eGmF26C yx+ZEknlqkQhnXbLnx4b9NJe8KJNRZywbKLa9R9GyIZCxGN4FbPTCAG6ABjxTmsXYFTw nE+nZC3E92FCca0pLDsmY/vN5vWPWsDJh6wS3FW0HsBR15pSeuj+JcVSwlnWLkxTu0sC JR3dP1emSOnncnMOpOvkXAjR1PMWHTviF6Pa2upGMxvi7jWw+zhXOZE7d0K9goqxe0bo PMMg== 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; bh=HLgMlmEKedm3Hc45kvD3KkAA9YvBKSa3pAwqdXBXykg=; b=nC/zu7ZjsbiKKmTPlRo4w+3kOpCh1NuRe5dpoOjxkoYRxxDrEX9/QXMnLI6D3vn4dd 6j0URxjpSU8ztDUc2GLbJ8XBuG2urGiBA5W2XH4zyDddYjQwb5Cl+UfHNohVzeJeRA8V P0e1DBEjjwhju/eyTpsEc+RpWcChJv8Px8nF5f8fc5DqgKMuiuMvP/gV2djpnKqTyvGs fMcwPRgC3gIPz02lmotsWoPXYtx/Z7LBcmbbDdJq/n1D64cxito8IgiTJCVZxwr3MtoQ bqPjAYKoY0v84GLPVpGnFXr6Xf/WrG3VTv0fsqL5RWGu9zZK62zL0ag4iqqO+yc/uIre phqg== 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 l9si285472ilt.83.2021.07.01.09.45.09; Thu, 01 Jul 2021 09:45:21 -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 S230061AbhGAQn4 (ORCPT + 99 others); Thu, 1 Jul 2021 12:43:56 -0400 Received: from mga18.intel.com ([134.134.136.126]:10380 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230018AbhGAQnz (ORCPT ); Thu, 1 Jul 2021 12:43:55 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10032"; a="195858618" X-IronPort-AV: E=Sophos;i="5.83,315,1616482800"; d="scan'208";a="195858618" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2021 09:41:24 -0700 X-IronPort-AV: E=Sophos;i="5.83,315,1616482800"; d="scan'208";a="457729529" Received: from abaydur-mobl1.ccr.corp.intel.com (HELO [10.249.231.202]) ([10.249.231.202]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2021 09:41:20 -0700 Subject: Re: [PATCH v8 06/22] perf record: Introduce data file at mmap buffer object To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , linux-kernel , Andi Kleen , Adrian Hunter , Alexander Antonov , Alexei Budankov , Riccardo Mancini References: From: "Bayduraev, Alexey V" Organization: Intel Corporation Message-ID: <2240e335-9991-8792-7437-c3ec88f6a7a2@linux.intel.com> Date: Thu, 1 Jul 2021 19:41:18 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 30.06.2021 20:23, Arnaldo Carvalho de Melo wrote: > Em Wed, Jun 30, 2021 at 06:54:45PM +0300, Alexey Bayduraev escreveu: >> Introduce data file and compressor objects into mmap object so >> they could be used to process and store data stream from the >> corresponding kernel data buffer. Make use of the introduced >> per mmap file and compressor when they are initialized and >> available. > > So you're introducing even compressed storage in this patchset? To make > it smaller I thought this could be in a followup cset. These patches were slit by request from Jiri: Changes in v5: - split patch 06/12 to 06/20 and 07/20 request: https://lore.kernel.org/lkml/YG97LMsttP4VEWPU@krava/ And I'm a bit confused :) Regards, Alexey > > - Arnaldo > >> Acked-by: Andi Kleen >> Acked-by: Namhyung Kim >> Signed-off-by: Alexey Bayduraev >> --- >> tools/perf/builtin-record.c | 3 +++ >> tools/perf/util/mmap.c | 6 ++++++ >> tools/perf/util/mmap.h | 3 +++ >> 3 files changed, 12 insertions(+) >> >> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c >> index cead2b3c56d7..9b7e7a5dc116 100644 >> --- a/tools/perf/builtin-record.c >> +++ b/tools/perf/builtin-record.c >> @@ -190,6 +190,9 @@ static int record__write(struct record *rec, struct mmap *map __maybe_unused, >> { >> struct perf_data_file *file = &rec->session->data->file; >> >> + if (map && map->file) >> + file = map->file; >> + >> if (perf_data_file__write(file, bf, size) < 0) { >> pr_err("failed to write perf data, error: %m\n"); >> return -1; >> diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c >> index ab7108d22428..a2c5e4237592 100644 >> --- a/tools/perf/util/mmap.c >> +++ b/tools/perf/util/mmap.c >> @@ -230,6 +230,8 @@ void mmap__munmap(struct mmap *map) >> { >> bitmap_free(map->affinity_mask.bits); >> >> + zstd_fini(&map->zstd_data); >> + >> perf_mmap__aio_munmap(map); >> if (map->data != NULL) { >> munmap(map->data, mmap__mmap_len(map)); >> @@ -291,6 +293,10 @@ int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu) >> map->core.flush = mp->flush; >> >> map->comp_level = mp->comp_level; >> + if (zstd_init(&map->zstd_data, map->comp_level)) { >> + pr_debug2("failed to init mmap commpressor, error %d\n", errno); >> + return -1; >> + } >> >> if (map->comp_level && !perf_mmap__aio_enabled(map)) { >> map->data = mmap(NULL, mmap__mmap_len(map), PROT_READ|PROT_WRITE, >> diff --git a/tools/perf/util/mmap.h b/tools/perf/util/mmap.h >> index 9d5f589f02ae..c4aed6e89549 100644 >> --- a/tools/perf/util/mmap.h >> +++ b/tools/perf/util/mmap.h >> @@ -13,6 +13,7 @@ >> #endif >> #include "auxtrace.h" >> #include "event.h" >> +#include "util/compress.h" >> >> struct aiocb; >> >> @@ -43,6 +44,8 @@ struct mmap { >> struct mmap_cpu_mask affinity_mask; >> void *data; >> int comp_level; >> + struct perf_data_file *file; >> + struct zstd_data zstd_data; >> }; >> >> struct mmap_params { >> -- >> 2.19.0 >> >