Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2573572pxb; Thu, 3 Feb 2022 09:21:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZoPuS6p+o1CewDlEkXtRHSe+SMCadtYtJ3NRMxcCvJxJNS69Ifulw3qKFWtF7tZfvRGMt X-Received: by 2002:a17:90a:de01:: with SMTP id m1mr14895551pjv.215.1643908871419; Thu, 03 Feb 2022 09:21:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643908871; cv=none; d=google.com; s=arc-20160816; b=yFd1eZlN9MOJxIaFiv/HNRutbFjHwGwLK9bN6JouEmTu6Vvua6uQzr7LGm5Iwd3oMJ V0Wv32budPOzaW7c6dLwjTOVSkY+v5ZVzj5l2oVyIN2d0q39utTSMmup437zMX9JdlLm 9h2Q40KwppDy1s2maK2fxdyMvuTkWduIKNfxd90HoZptHonmw7RHv4hZajpL8hDOubt3 7ksTcADZp2F3NQj8Mt0Ho///1N4G6olQw/OlW7mp3+e1B8pcMd2HNA32hAKqPhe5a8B5 gNRqtu0EtJo6fLIS4c9KXRhPnsmm8yfUyoah2VrYA/aP0JHeGH1Ej9G6VKSq/MhSc4cc DmtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=ZBw3EngGoffXP8d4yd9sFYfwXw/p78RC82NyA5dUOeI=; b=iJSDUzhTRLG1K2JZlFRkH+Mc5yB3FzroVWBsFTwlXtCnY1aQcN2VLD9JnvKPl64SyK 56di+Lgnxwaz05C80fm4TB1jWgrkcw6MQKbT+KpK0UT39K5yC2qx0QxvccktlTxHLK22 FRN/HruZuDLaWvOamYLYHDRZgs8h6SdwXSkHSxcXPnd0WyVAbbpRw8HB2XcrSV3fV46r TUo40yDfnbYoSoD4NFvXsbxp2/DVD+ScTEJrCSzdYlpbQKRfyTV5kh7Fpzyh/3rg8s+6 aKoj4z76YX9bPSh2y6420lM84L1Rd4Vvk9M+oBvJ2Qbc8I2I2kp62dRZ0+SnXh8yHFur AZ1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nDzMzNCv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 188si22016381pgb.527.2022.02.03.09.20.57; Thu, 03 Feb 2022 09:21:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nDzMzNCv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234662AbiBAII5 (ORCPT + 99 others); Tue, 1 Feb 2022 03:08:57 -0500 Received: from mga04.intel.com ([192.55.52.120]:6555 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbiBAII4 (ORCPT ); Tue, 1 Feb 2022 03:08:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643702936; x=1675238936; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=qrTzs7KNuNvowMdSGJ1jIYqS1al0ZQmkfwngAUCdmn8=; b=nDzMzNCvqp+/0zzf9d6HqF985wrJYOp0fpp/VKC0rsEDhxoDWXfEtmnH 7qqThS7WsT9CwoUvYfvJE3VvB9DgWcOwMA4fwk/VjguhlnoxUJ/FL7xXP ov7DrJLRhQwNJjwzg5qBIrg93R87GGr3Bb/7nRAYS3ZhIzLgWz6MJaTO4 8aqdCLbUV/TWKVNVhEmtvK1WI48bMWNv7Uju38Ie08jiSo8X7ON+mxHmH C/8ZEhmUVmb2Q3g1UIgD7Ti3pcCa+bBm5Svx2onC2fi3/mIr+fF6vQi7H nZCyw+EtG8Pu2SpyG4LT7hsB6l1TMzcIAo5OtT/q95SYjSyB7mJzdj1bb A==; X-IronPort-AV: E=McAfee;i="6200,9189,10244"; a="246473941" X-IronPort-AV: E=Sophos;i="5.88,333,1635231600"; d="scan'208";a="246473941" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2022 00:08:56 -0800 X-IronPort-AV: E=Sophos;i="5.88,333,1635231600"; d="scan'208";a="522973152" Received: from abaydur-mobl1.ccr.corp.intel.com (HELO [10.249.225.106]) ([10.249.225.106]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2022 00:08:52 -0800 Message-ID: <9867b3a1-8c73-077a-73f6-013af7209b4d@linux.intel.com> Date: Tue, 1 Feb 2022 11:08:49 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH v13 10/16] perf record: Introduce compressor at mmap buffer object Content-Language: en-GB 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: <80edc286cf6543139a7d5a91217605123aa0b50d.1642440724.git.alexey.v.bayduraev@linux.intel.com> From: "Bayduraev, Alexey V" Organization: Intel Corporation In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01.02.2022 0:56, Arnaldo Carvalho de Melo wrote: > Em Mon, Jan 17, 2022 at 09:34:30PM +0300, Alexey Bayduraev escreveu: >> Introduce compressor object into mmap object so it could be used to >> pack the data stream from the corresponding kernel data buffer. >> Initialize and make use of the introduced per mmap compressor. SNIP >> --- a/tools/perf/util/mmap.c >> +++ b/tools/perf/util/mmap.c >> @@ -230,6 +230,10 @@ void mmap__munmap(struct mmap *map) >> { >> bitmap_free(map->affinity_mask.bits); >> >> +#ifndef PYTHON_PERF >> + zstd_fini(&map->zstd_data); >> +#endif >> + > > Exposing this build detail in the main source code seems ugly, casual > readers will scratch their heads trying to figure this out, so either > we should have this behind some macro that hides these deps on a header > file or add a comment stating why this is needed. This is quick fix for the fact that the perf.so library for Python is not compiled with -lzstd, but it includes mmap.c. Probably adding stub macro to mmap.h would be better. Regards, Alexey > > >> perf_mmap__aio_munmap(map); >> if (map->data != NULL) { >> munmap(map->data, mmap__mmap_len(map)); >> @@ -292,6 +296,12 @@ int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, struct perf_cpu >> map->core.flush = mp->flush; >> >> map->comp_level = mp->comp_level; >> +#ifndef PYTHON_PERF >> + if (zstd_init(&map->zstd_data, map->comp_level)) { >> + pr_debug2("failed to init mmap commpressor, error %d\n", errno); >> + return -1; >> + } >> +#endif >> >> 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 62f38d7977bb..cd8b0777473b 100644 >> --- a/tools/perf/util/mmap.h >> +++ b/tools/perf/util/mmap.h >> @@ -15,6 +15,7 @@ >> #endif >> #include "auxtrace.h" >> #include "event.h" >> +#include "util/compress.h" >> >> struct aiocb; >> >> @@ -46,6 +47,7 @@ struct mmap { >> void *data; >> int comp_level; >> struct perf_data_file *file; >> + struct zstd_data zstd_data; >> }; >> >> struct mmap_params { >> -- >> 2.19.0 >