From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 66B7FC7EE25 for ; Fri, 9 Jun 2023 00:31:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version :Message-Id:In-Reply-To:Date:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rXAwHCIWD95E9ZFDhSGa01H4b9kPBVjM3NlKWc8wc6g=; b=Vmwcu9OvXFKX57 MAy0XTnKlqYPl3BXP3DEX0wQulaRHtQHiHtG3DqPzYwA91FHJLRFo5YQrSKyGqVbqdsVXYVqvOigQ GWlA3iSKo+Y88r6ueWhtXhllf7WcVhGAIbW1x/nbPiuyHzh4D3fti/Ams1UViyeok7H9Wslgv5lEC FP1YcgGM6fivdxRZRHJzo55SOrrDpzNvxDNH5Y2YZpXxw5M4fRht5+xEAC+wxTwkN6gXDBzcEBDPv cis4fTvmfUQ6yPhmg328zwFSlQbx87Dx+E39BZzW7b8kNWnmz7krwcPp7JclHgHaMVkr61WYmf+go /lulfXiB6uXPLurWdYaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q7Q1n-00B4DE-0n; Fri, 09 Jun 2023 00:30:55 +0000 Received: from mail-yw1-f201.google.com ([209.85.128.201]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q7P4Q-00Av0e-11 for linux-arm-kernel@lists.infradead.org; Thu, 08 Jun 2023 23:29:37 +0000 Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-5651d8acfe2so16060667b3.2 for ; Thu, 08 Jun 2023 16:29:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1686266971; x=1688858971; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=YK7vivTUvVnngeLWzmeZQ8bqT/OVbRyCOXzMTcRsZMs=; b=h0zjH+hUAGfTVAZ7FUCUWS+twdPiVH3SkQmolEIxSW6NKYWlfbX93GzrWc0xPE87rf GCtKAcWHTFnmrRx0x6g+aMCnF7/smB+83LTuyDWpYDRcBrXRI/peA8iy6uqEdPuoCgj1 mPwWGkuikA6MRqCdj7bkDOG2NI8ry+HbmvIEhZhn1iD9NXqlyOaZpSxwAplOp0GWqF7z h5TYTJfZ7Jeg/PmuzM79qNA7lNueWIaXYZdQqBZO3NpBdb7VYJ4HTbfCk4DNYH3QTFZW 3PgUNJ4Hc4UT5cofyQPEGCkxVMzE1BLJp/+LuT/CPLshhnrbL8XBMMKqqmuVgW9aQ3vW 4uZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686266971; x=1688858971; 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=YK7vivTUvVnngeLWzmeZQ8bqT/OVbRyCOXzMTcRsZMs=; b=FxzvbmupeGWnkCisZDp+MgG0Le7Ug7bRvz15YHbmg0PFz1l0tKNiA4jzV91klFzNHl jdejt+F7oDnB7t/38eFP9BLJ3BODiKmEbBlBNd0w7is9WxciCkECzzbQd5Av3oOlsqbk LTX6EVx6gB89JOq56avE6CkqMhiv9KRv8swZd6v1VQfXclDC8ulW08gUtDBenmeC8Zy7 m/sOE+r4El+Vl+pux0IxOg9SiT2VAR/ULDTKHBy4tg+vljthSwfVQ3XETf2SnTaCJDc+ hDkorJ55W0G5+cTR9n3Rgqc48syluJGGgOhFY6hcEkO2de+7jIbTS6XOWFujV8YWwxQP BjuA== X-Gm-Message-State: AC+VfDz3i7NYEkgjWGFryY7ISz+HIZnvbvyl+JIjIbv7MnyqEpn+uiIf oRUOruMM7rVNlQNMM7NaNVDS1z5NHVW3 X-Google-Smtp-Source: ACHHUZ7lFo/l4NRGaS+SLLEGSLVGTsSlh5Hy8OpV3peTtU6WbuCKJ2Yl1mIVlrFEjceAhvhpmJc2Y0yNelZO X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:c3e5:ebc6:61e5:c73f]) (user=irogers job=sendgmr) by 2002:a81:ad59:0:b0:561:c9c0:98d9 with SMTP id l25-20020a81ad59000000b00561c9c098d9mr673787ywk.4.1686266971518; Thu, 08 Jun 2023 16:29:31 -0700 (PDT) Date: Thu, 8 Jun 2023 16:28:05 -0700 In-Reply-To: <20230608232823.4027869-1-irogers@google.com> Message-Id: <20230608232823.4027869-9-irogers@google.com> Mime-Version: 1.0 References: <20230608232823.4027869-1-irogers@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Subject: [PATCH v2 08/26] perf machine: Make delete_threads part of machine__exit From: Ian Rogers To: John Garry , Will Deacon , James Clark , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Suzuki K Poulose , "Naveen N. Rao" , Kan Liang , German Gomez , Ali Saidi , Jing Zhang , Athira Rajeev , Miguel Ojeda , ye xingchen , Liam Howlett , Dmitrii Dolgov <9erthalion6@gmail.com>, Yang Jihong , K Prateek Nayak , Changbin Du , Ravi Bangoria , Sean Christopherson , Andi Kleen , "Steinar H. Gunderson" , Yuan Can , Brian Robbins , liuwenyu , Ivan Babrou , Fangrui Song , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, coresight@lists.linaro.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230608_162934_370884_DA09C301 X-CRM114-Status: GOOD ( 13.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The code required threads to be deleted before machine__exit was called or the threads would be leaked. This was error prone so move the delete_threads into machine__exit. Signed-off-by: Ian Rogers --- tools/perf/tests/code-reading.c | 1 - tools/perf/tests/dwarf-unwind.c | 1 - tools/perf/tests/mmap-thread-lookup.c | 1 - tools/perf/tests/symbols.c | 1 - tools/perf/util/machine.c | 1 + tools/perf/util/session.c | 6 ------ 6 files changed, 1 insertion(+), 10 deletions(-) diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 2a7b2b6f5286..ed3815163d1b 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c @@ -721,7 +721,6 @@ static int do_test_code_reading(bool try_kcore) evlist__delete(evlist); perf_cpu_map__put(cpus); perf_thread_map__put(threads); - machine__delete_threads(machine); machine__delete(machine); return err; diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c index ee983b677a6a..d01aa931fe81 100644 --- a/tools/perf/tests/dwarf-unwind.c +++ b/tools/perf/tests/dwarf-unwind.c @@ -235,7 +235,6 @@ noinline int test__dwarf_unwind(struct test_suite *test __maybe_unused, thread__put(thread); out: - machine__delete_threads(machine); machine__delete(machine); return err; } diff --git a/tools/perf/tests/mmap-thread-lookup.c b/tools/perf/tests/mmap-thread-lookup.c index 3891a2a3b46f..ddd1da9a4ba9 100644 --- a/tools/perf/tests/mmap-thread-lookup.c +++ b/tools/perf/tests/mmap-thread-lookup.c @@ -208,7 +208,6 @@ static int mmap_events(synth_cb synth) addr_location__exit(&al); } - machine__delete_threads(machine); machine__delete(machine); return err; } diff --git a/tools/perf/tests/symbols.c b/tools/perf/tests/symbols.c index 2d1aa42d36a9..16e1c5502b09 100644 --- a/tools/perf/tests/symbols.c +++ b/tools/perf/tests/symbols.c @@ -38,7 +38,6 @@ static int init_test_info(struct test_info *ti) static void exit_test_info(struct test_info *ti) { thread__put(ti->thread); - machine__delete_threads(ti->machine); machine__delete(ti->machine); } diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 261188766307..46af5e9748c9 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -256,6 +256,7 @@ void machine__exit(struct machine *machine) zfree(&machine->current_tid); zfree(&machine->kallsyms_filename); + machine__delete_threads(machine); for (i = 0; i < THREADS__TABLE_SIZE; i++) { struct threads *threads = &machine->threads[i]; diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 65ac9f7fdf7e..00d18c74c090 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -278,11 +278,6 @@ struct perf_session *__perf_session__new(struct perf_data *data, return ERR_PTR(ret); } -static void perf_session__delete_threads(struct perf_session *session) -{ - machine__delete_threads(&session->machines.host); -} - static void perf_decomp__release_events(struct decomp *next) { struct decomp *decomp; @@ -305,7 +300,6 @@ void perf_session__delete(struct perf_session *session) auxtrace__free(session); auxtrace_index__free(&session->auxtrace_index); perf_session__destroy_kernel_maps(session); - perf_session__delete_threads(session); perf_decomp__release_events(session->decomp_data.decomp); perf_env__exit(&session->header.env); machines__exit(&session->machines); -- 2.41.0.162.gfafddb0af9-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel