Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2184991rda; Tue, 24 Oct 2023 15:24:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJd9JYStyJZQKdc6DD4mQtjQdscBvYl4DQD9UVkyL8MbD5/F817LmQQ8+g4yYUCK7WynB6 X-Received: by 2002:a05:6359:4b8c:b0:168:f602:d61 with SMTP id oi12-20020a0563594b8c00b00168f6020d61mr2875657rwb.32.1698186292284; Tue, 24 Oct 2023 15:24:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698186292; cv=none; d=google.com; s=arc-20160816; b=Y/66DiiKtD/dGzoeSmkI7S5b8ci/HjTidUCdt/uDZN29IxqGbR9Tt0ZtiqWMYeSpZs cmNDjNwncPo8UFYwp6LFnaflXpVm4hj+duuM15ad8XurTzMd4MIbwWBPke6d/XVnWnDI V1N8grCII/IvAM+a7o7cAVd9vwPJVBCEr6CK7rnU7+YZ7mv1MXce0ZUb2TIwle8QxblO AWDXuTlHweUidkVx6+EUXDDoy2b8exwJCn9bw1db02JZDjk856Fg+zz8O0walUl6RPMi o30uuYDmayZsbxWxY/lxg7ffhIDJ/j3XcuMxGEfgMZ3fFseA80EVT/t4B0P94n1U5Cpz kpeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=cG5+OY088Om6+iLiqKt06WFCMXUosiNbLSusAjLjbIM=; fh=NAro5oTsDEB2Or99ABwb774QJkwQSkr6EoLVqn/Yde0=; b=ZOISWu0xCP+D0JACUYcgGak0K5ijMaAPppkGNOtNWhYdRT34XVotmvi0toXnNpCMmE jdWqpGd4WYgr2YB6j6zgoIzUssDOROMdE4yZtgpXcG19Aye2QjzWAwSd1cmBr0NRuKWR PRUnGkqtsHtw9e4VPuZp4ZvteRgk+gR7AK4cnXqSTEw/n3VGuTP0n9ccD+KYWczNe/Pf iEGv7DA6qNzYbHwJseWtjw29PHN+CSkULwgcr42NHttZ/i9oMkt+fdjam4v0xi4ObKog kH0Be/cEb49/EtCGUhaJzNlYXnOx65l+lZyYk/y7n/0iKPzYYlgmjFjKSZx220xfpzDe 0U/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ZZqrKT+U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id w8-20020a63f508000000b005b874265d1fsi8563966pgh.513.2023.10.24.15.24.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 15:24:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ZZqrKT+U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 72DBD805060B; Tue, 24 Oct 2023 15:24:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344501AbjJXWYf (ORCPT + 99 others); Tue, 24 Oct 2023 18:24:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344440AbjJXWY3 (ORCPT ); Tue, 24 Oct 2023 18:24:29 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C19B210DA for ; Tue, 24 Oct 2023 15:24:24 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d9c4ae201e0so251735276.1 for ; Tue, 24 Oct 2023 15:24:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698186264; x=1698791064; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=cG5+OY088Om6+iLiqKt06WFCMXUosiNbLSusAjLjbIM=; b=ZZqrKT+UjHHvy/H00VQVIZt3PiS/jfnqDnz7ouPps9VLW80Fv2MkQkEZp+0e3wLOvi aIC9Le/kVULcDKBJ0GuhTEYHFDpIpHkFYeU2Vivs0+agAus9cmVUypi2M6ZIE5lsnBwd F0x4UKY7hlNf8NIh4Hiky32niofP45ujmy8OV6r4DCzjX2xk21gGUPKeve6IZmY/i0/w MpxWzRL0gKARR1KGhg9O6ItbnHJWZ/Fd1AVL3ooyhebg2Fnjq1GzBJGN8uO/fVV+FRBT ef0MFik8vbgkT404AwvA9/VZ8dcmVWEn/uZN0ECmOGyWEFjzxotYS3SucyA82jueLp4D b7Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698186264; x=1698791064; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cG5+OY088Om6+iLiqKt06WFCMXUosiNbLSusAjLjbIM=; b=d4WGfQrILMSEjNpPKavyT9Z51Sc1/isgzOdyugUqkEKw9C4Zt6LNROGEGoRohRiY6c pY+LzyjDtdjmQZABMPpjAHXcyUtQBQX1YvB/NZS7rWNsmT+WYwaeuaUIMeqERPwIWQJk euF4qgDjCHu/Jb5z46Q7q7rcDLKKnJaH+eeuVe/Si2UjbXdxOdX4QtjjfTnH7+5UPrUE GKbQGa66dSGd2qSo2Pb+tAy76nEmqN7KIOUeaeEN3VCJ11te8NuSurLzeb/ZceN1H1h1 kMXputmf3bSKasKozuzrMdcu2ry6VzsVEupSxFmS9YHQtnOS/zW3XYBuqJeU1pnefLu3 icpQ== X-Gm-Message-State: AOJu0YxMN4ZeeLL1MDXvlvoIMHayYy9THt8Xd6zTc1xrIlgUMHXkz736 QwBvP+aP90kzOzeb9KxIR8sp5vCasfnl X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:93d2:18cc:4d63:45ba]) (user=irogers job=sendgmr) by 2002:a25:34d1:0:b0:d9a:6360:485b with SMTP id b200-20020a2534d1000000b00d9a6360485bmr385686yba.2.1698186263960; Tue, 24 Oct 2023 15:24:23 -0700 (PDT) Date: Tue, 24 Oct 2023 15:23:08 -0700 In-Reply-To: <20231024222353.3024098-1-irogers@google.com> Message-Id: <20231024222353.3024098-6-irogers@google.com> Mime-Version: 1.0 References: <20231024222353.3024098-1-irogers@google.com> X-Mailer: git-send-email 2.42.0.758.gaed0368e0e-goog Subject: [PATCH v3 05/50] perf hist: Add missing puts to hist__account_cycles From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Nick Terrell , Kan Liang , Andi Kleen , Leo Yan , Song Liu , Sandipan Das , James Clark , Anshuman Khandual , Miguel Ojeda , Liam Howlett , Yang Jihong , Athira Rajeev , Kajol Jain , K Prateek Nayak , Sean Christopherson , Yanteng Si , Ravi Bangoria , German Gomez , Changbin Du , Paolo Bonzini , Masami Hiramatsu , liuwenyu , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 24 Oct 2023 15:24:49 -0700 (PDT) Caught using reference count checking on perf top with "--call-graph=lbr". After this no memory leaks were detected. Fixes: 57849998e2cd ("perf report: Add processing for cycle histograms") Signed-off-by: Ian Rogers --- tools/perf/util/hist.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index cde0078e6c90..0aa7e231172a 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -2676,8 +2676,6 @@ void hist__account_cycles(struct branch_stack *bs, struct addr_location *al, /* If we have branch cycles always annotate them. */ if (bs && bs->nr && entries[0].flags.cycles) { - int i; - bi = sample__resolve_bstack(sample, al); if (bi) { struct addr_map_symbol *prev = NULL; @@ -2692,7 +2690,7 @@ void hist__account_cycles(struct branch_stack *bs, struct addr_location *al, * Note that perf stores branches reversed from * program order! */ - for (i = bs->nr - 1; i >= 0; i--) { + for (int i = bs->nr - 1; i >= 0; i--) { addr_map_symbol__account_cycles(&bi[i].from, nonany_branch_mode ? NULL : prev, bi[i].flags.cycles); @@ -2701,6 +2699,12 @@ void hist__account_cycles(struct branch_stack *bs, struct addr_location *al, if (total_cycles) *total_cycles += bi[i].flags.cycles; } + for (unsigned int i = 0; i < bs->nr; i++) { + map__put(bi[i].to.ms.map); + maps__put(bi[i].to.ms.maps); + map__put(bi[i].from.ms.map); + maps__put(bi[i].from.ms.maps); + } free(bi); } } -- 2.42.0.758.gaed0368e0e-goog