Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1988250rwl; Thu, 30 Mar 2023 04:35:09 -0700 (PDT) X-Google-Smtp-Source: AKy350Z1pW4xpnI62xX/GyYij9HTU5OOsN9No7rZkxJTl7t3LBuh9cR93xGUr2waH5duxNaqyQvg X-Received: by 2002:a17:902:7d89:b0:19c:f005:92de with SMTP id a9-20020a1709027d8900b0019cf00592demr1905592plm.4.1680176109197; Thu, 30 Mar 2023 04:35:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680176109; cv=none; d=google.com; s=arc-20160816; b=Hk5qbR3fwAYInq9wyEcKVQtiKVed9ruROzj0ApaYuL8IXzJydZUzgfZOwVcjgXRFY8 44CXnKb9eCwf5eJJuY6o5L9L3OWYv2hEuWhq4ZlBWjtxME+HARs+Q5Vae8mjarb/1fPZ Y4AzsuCSXMaLkbQDjcqc6U96q2y1wV58+FKCyLJs+WTRUyj1mrfBycF5sotlNT7XG8Kw AKAezVFk/MftczSVtdOEQL+z0vrgk44pXpfO4w9bwn5lpIEPAmf19xvXPmvGTFbmWsIu v3gM1qXOvcGKnCTiKJMpytb8TfDksKDo407XRqZEE20MVxEK9MXtLCIOGW/u/LpbFOPJ Krkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=JKrmU0BSQOAwVSW7/kJnVGxDUpYwefU/6DSgiQiMlGI=; b=RAvSsDUiRn4Abqmu1uoAafy9PKMyOCGknkqaj6DWz2c35l7YgWAoERMVuiUBXXpgfF 8H6Pv471AgOSUmiwnCEOqfEIoxF9v8V+z+mD+iRkGRLyAkaak0/DS6pDcK1VHjrhB4s1 +kg0mLVKG1BC0umYj0KG3/1cVcKZIyb+02t03A9HuhNLlARKZVZZ0XyO7LrFvHtjzkgD 9dObVrZ+ROR5+PXuK5FO7vMdZFqMRpQ3bc2w9NZ3D8l6JC81n1nB6rrNqwXve7+xBRWa 8Ky6LnO6VLW2BSFVFlR1C9fkmO38PWztNou6aDDNn+23gKBuIwJ4ZEO5AwFROkrAiPU6 sc5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AhDEVRDK; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o23-20020a17090ac71700b002342479527bsi3816091pjt.126.2023.03.30.04.34.57; Thu, 30 Mar 2023 04:35:09 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=AhDEVRDK; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231151AbjC3LY1 (ORCPT + 99 others); Thu, 30 Mar 2023 07:24:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231570AbjC3LY0 (ORCPT ); Thu, 30 Mar 2023 07:24:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 543BB9ED4; Thu, 30 Mar 2023 04:24:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A7D6C61FF9; Thu, 30 Mar 2023 11:24:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8BABC4339B; Thu, 30 Mar 2023 11:24:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680175456; bh=xFvfkDhlD42bbhG0/jmteNSsxN7TAyt6/qTM1+Zrp4Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AhDEVRDKsT0plQhsp+zjgwto8GumsWvEMq4PGtlbWZaLJRcR+QMecqf7zrZk1cBer ArUUBYmcABR6qGwsvOmSh95C/sASEPyqvbQliNh30X1pXcaHWLQp3pwxgMbmMiclu4 dLBVKFikm6lTMrJZ4tn4byNbaYMszWu2QJDqnKRviROJg7r6ZNmslle4HMgaNQjPKn D6n7yh9NCwZD4XR2hKt9qvKGVDYKOL559qYQTM5Ceyh2+2Tp99TnTIFl5H2CNdY4Gj tOfWSSA4GmtCF95FoUxQaCWW7s7LAa0afiC1a0zXKK5YVsCPx4oBsUeywZkR/tNPXx uWRZLDCCOLX9w== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id BBEE74052D; Thu, 30 Mar 2023 08:24:13 -0300 (-03) Date: Thu, 30 Mar 2023 08:24:13 -0300 From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Ian Rogers , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Nathan Chancellor , Nick Desaulniers , Tom Rix , James Clark , Andi Kleen , Kan Liang , German Gomez , Sandipan Das , Andres Freund , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH v1 1/6] perf annotate: Delete session for debug builds Message-ID: References: <20230328235543.1082207-1-irogers@google.com> <20230328235543.1082207-2-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, Mar 29, 2023 at 05:13:17PM -0700, Namhyung Kim escreveu: > On Wed, Mar 29, 2023 at 6:18 AM Arnaldo Carvalho de Melo > wrote: > > > > Em Wed, Mar 29, 2023 at 10:09:48AM -0300, Arnaldo Carvalho de Melo escreveu: > > > Em Tue, Mar 28, 2023 at 04:55:38PM -0700, Ian Rogers escreveu: > > > > Use the debug build indicator as the guide to free the session. This > > > > implements a behavior described in a comment, which is consequentially > > > > removed. > > > > > > > > Signed-off-by: Ian Rogers > > > > --- > > > > tools/perf/builtin-annotate.c | 16 ++++++---------- > > > > 1 file changed, 6 insertions(+), 10 deletions(-) > > > > > > > > diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c > > > > index 4750fac7bf93..98d1b6379230 100644 > > > > --- a/tools/perf/builtin-annotate.c > > > > +++ b/tools/perf/builtin-annotate.c > > > > @@ -692,16 +692,12 @@ int cmd_annotate(int argc, const char **argv) > > > > > > > > out_delete: > > > > /* > > > > - * Speed up the exit process, for large files this can > > > > - * take quite a while. > > > > - * > > > > - * XXX Enable this when using valgrind or if we ever > > > > - * librarize this command. > > > > - * > > > > - * Also experiment with obstacks to see how much speed > > > > - * up we'll get here. > > > > - * > > > > - * perf_session__delete(session); > > > > + * Speed up the exit process by only deleting for debug builds. For > > > > + * large files this can save time. > > > > */ > > > > +#ifndef NDEBUG > > > > + perf_session__delete(annotate.session); > > > > +#endif > > > > > > So now, but default, we will call this, as we don't have this defined > > > only if DEBUG=1 is set, right? > > > > > > ⬢[acme@toolbox perf-tools-next]$ find tools/perf/ -type f | xargs grep NDEBUG > > > tools/perf/util/mutex.c:#ifndef NDEBUG > > > ⬢[acme@toolbox perf-tools-next]$ > > > > We can discuss this later, applied the series with just that zfree() > > change to annotation_options__exit(). > > I don't think it's just an issue in the perf annotate. Maybe we can > do the same for perf report and so on. Yes, I thought at some point of setting some flag, perf_exiting, and then we would stop releasing memory, zfree comes to mind, but then we would still be traversing data structures, taking locks, etc. And we can't just exit() as we may need to flush caches, etc. IIRC this specific case appeared in profiles, so was commented out. > Anyway we could define NDEBUG=1 for release builds from now on. Yes, we should do it. - Arnaldo