Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp57725pxb; Tue, 2 Mar 2021 19:03:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzxaHf10Xxz1W7rKefXZL547y/De2+ADtqbGwWueYckGg0BkD1fRVwzPWatz9g7OTzpqoUP X-Received: by 2002:aa7:db4f:: with SMTP id n15mr16033012edt.12.1614740624443; Tue, 02 Mar 2021 19:03:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614740624; cv=none; d=google.com; s=arc-20160816; b=m9axRWVIzW2wZPshswfWp6Vaqe+4MZnyITpEmDCIFWMWWg85Xh/G880j3uCY7AZxls n8SmUZdjjZYJYKt3lKxxpoLHVJuQDA5OyYqrvdNfc3B9SJLbtVZRLvnB1y08zCDFVfd4 KiLTy/3ZxwGagzwgwy+4qB/xMzGY78VA/eMwb9NMFCZVqPZfFojPluq2aBjQXYroQsqz qNYqM5ArcuY+dBTt9KK/tKkW2CZJHaUUxSxNgickhHBfVNG0D7LP63sEGQUvfr0Fwmf+ BNfDAWu9unD9jpwbNl6uXW0/AGLHD0YIfG/sFP1u2RnB52jNT5DoxwrxWbHtHtYvb9v9 kSHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=Zy394OIiEXrcyVa4GVnex3pNThpnw15z5YQ9o7yOnc8=; b=pj3miozVxlgSuGnQ7vQYaFwcGdhoaUH0YMODJHCFKqGyhhw2h/H2PvPSOE6umZRmgv gfcAxh0TtCbsUWE5xQ9foryo/KwkprIPjs2PHvRDjTLuYhbvzabGX/IEm6drA6kx/QFW k9ONUww+2hdLpU97+kfH3Hm7v/j+sl0c3PsUcebzCA7y9oblSbG5hgZHhRLxe6V59SXg RiIFJcviWmb5wruFAnmMH0YUwlMzRrmUOeBYgToH2J1Ul7zWhT9lIN5thItiM7vD/VaW pCbR2rIbjYu5576Vunnwlz3o2+bsASkF96exj90D+4RqfUXpZxXQcrkhXbE34btEvBTl p7Uw== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z23si14729773edr.483.2021.03.02.19.03.22; Tue, 02 Mar 2021 19:03:44 -0800 (PST) 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233493AbhCALp0 (ORCPT + 99 others); Mon, 1 Mar 2021 06:45:26 -0500 Received: from mail-lf1-f52.google.com ([209.85.167.52]:38443 "EHLO mail-lf1-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234058AbhCALpS (ORCPT ); Mon, 1 Mar 2021 06:45:18 -0500 Received: by mail-lf1-f52.google.com with SMTP id m22so24990314lfg.5 for ; Mon, 01 Mar 2021 03:45:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Zy394OIiEXrcyVa4GVnex3pNThpnw15z5YQ9o7yOnc8=; b=UCJRCVkNQ9gVIF9xLzi1saLEkQ4QiV2I8u9eU9/jsjg1RBe8gwZhqyTPSmi0ucDwa+ KicvKWWSkktmNKw+hUln+plxoLL8sxjlwgudnpjorSPjZhAOR62kL0a3xGWTmfgmTB53 TmUn9mO8UOIeQ8lck2bsFqVETRL5PRDckhROq/rvGEkw7xLg8tmcIoSiilWCmupefkeF pReBt1yaL5N1tlwQf/h/5MqybPNchLs6jHSaIu+0OiieGvgAhAFLhEhHmANzdH9avZX0 9ljv4ZjmtJpu/rwS4VKzX5QAqZn6MLMn5uyW7jGj2ozFP8MC4jhv7DkM6RFHXvsIbpHr MvKw== X-Gm-Message-State: AOAM533pGv0iFyei/tohJ83Fp/0IuJJew4OKu9QRQIiBukT4FU9eLhrM vIAKWvQ/zezx0ExoyaRGl6CGQtR3HreGRGLTGlU= X-Received: by 2002:a05:6512:21a3:: with SMTP id c3mr8926653lft.635.1614599075795; Mon, 01 Mar 2021 03:44:35 -0800 (PST) MIME-Version: 1.0 References: <7d197a2d-56e2-896d-bf96-6de0a4db1fb8@linux.intel.com> <20201120104942.GF94830@google.com> <64b0859f-aad3-43fa-4e4c-81614d0c75e4@linux.intel.com> In-Reply-To: <64b0859f-aad3-43fa-4e4c-81614d0c75e4@linux.intel.com> From: Namhyung Kim Date: Mon, 1 Mar 2021 20:44:24 +0900 Message-ID: Subject: Re: [PATCH v3 07/12] perf record: init data file at mmap buffer object To: "Bayduraev, Alexey V" Cc: Alexei Budankov , Arnaldo Carvalho de Melo , Jiri Olsa , Alexander Shishkin , Peter Zijlstra , Ingo Molnar , linux-kernel , Andi Kleen , Adrian Hunter , Alexander Antonov Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Mon, Mar 1, 2021 at 8:16 PM Bayduraev, Alexey V wrote: > > Hi, > > On 20.11.2020 13:49, Namhyung Kim wrote: > > On Mon, Nov 16, 2020 at 03:19:41PM +0300, Alexey Budankov wrote: > > > > >> > >> @@ -1400,8 +1417,12 @@ static int record__mmap_read_evlist(struct record *rec, struct evlist *evlist, > >> /* > >> * Mark the round finished in case we wrote > >> * at least one event. > >> + * > >> + * No need for round events in directory mode, > >> + * because per-cpu maps and files have data > >> + * sorted by kernel. > > > > But it's not just for single cpu since task can migrate so we need to > > look at other cpu's data too. Thus we use the ordered events queue > > and round events help to determine when to flush the data. Without > > the round events, it'd consume huge amount of memory during report. > > > > If we separate tracking records and process them first, we should be > > able to process samples immediately without sorting them in the > > ordered event queue. This will save both cpu cycles and memory > > footprint significantly IMHO. > > > > Thanks, > > Namhyung > > > > As far as I understand, to split tracing records (FORK/MMAP/COMM) into > a separate file, we need to implement a runtime trace decoder on the > perf-record side to recognize such tracing records coming from the kernel. > Is that what you mean? No, I meant separating the mmap buffers so that the record process can save the data without decoding. > > IMHO this can be tricky to implement and adds some overhead that can lead > to possible data loss. Do you have any other ideas how to optimize memory > consumption on perf-report side without a runtime trace decoder? > Maybe "round events" would somehow help in directory mode? > > BTW In our tool we use another approach: two-pass trace file loading. > The first loads tracing records, the second loads samples. Yeah, something like that. With the separated data, we can do it more efficiently IMHO. Thanks, Namhyung