Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp45427lqo; Tue, 7 May 2024 11:37:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWl/ivekYkVUVNaNbrjBRK/92JsFvvUtK79412avcA+MG9tZvKeFaS8+sunFVEHDLiL9Kjd3kmSfpjTmBJccF8Qht3P9crtVKryEIW5aA== X-Google-Smtp-Source: AGHT+IHB2eFgMupoEdl9i/QcF1eqgJOZ2psTcIEaGCQ3/GCOpBpBgGF3dZFnkLwgpLrMlPOswJja X-Received: by 2002:a05:6a21:3994:b0:1a9:5e63:501b with SMTP id adf61e73a8af0-1afc8dc6c4bmr688438637.44.1715107051862; Tue, 07 May 2024 11:37:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715107051; cv=pass; d=google.com; s=arc-20160816; b=ufmxshILmhc5wFOmz8U4PFU2CTaEWNrufHMVdWCFiFgbIRqB1Y/r1YQKZiETgb25qm v21ldG9vkrRUHzbvWk+WtKicDsWgNf+WKyNoMuTIho3yFdr/6ESR0cGCPIqtX1WFFDql i3RQqmFnlvCASAH55MYkBnSIbETe3WFAfbSeBQ5Zn0Ml366ne+JrdQRAa7o2gr8D2Ruk uGNQ2jQUn544fnCcYy/AYBprSEl47puennWM+Ck5dm7PSViROuovjFsJEDbSZJGEk7tW qX9YrIVaPckpTPnh36wGSV9bsdXGTg+qoZUwpYvG5EUrY9GXBzwgJT1+IxFZIAR4AZzj zlhA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=4mOLkDwQHg5DuUlszkofmEYevyYYNPUsj80iyE8YhBY=; fh=llmWSZWnqr8lhvUfrygXOPwceLoJcUZoTulIz/S8sWc=; b=Bzk360ESBa/yHLO03lEASAQE/dtocX44Y6dRvXkxWyMjOV5cLzJ0Q+nKHTbKhJteyG HM0sKIrLpvh3JuSDve2GWbGl6wTWjN2K3crS1ZQwxdCbru5I3sOi8Ok/uHuwfz92h+La b+0ZKi/OOUwXQ6noSL1fQYZQ0Via+KV9ea1eUMS0UU/hFOetxtkny/DyfoQbunQISO7W LXuPDWv3ZcetCwgtXeYmPgH0JVsbb77f8KvbLehSvQLyDOYcmq1uvnr/BvRiiS9I7ECz 6e5Ns97UR9Ls60ptVwLZNbrOIX8psKF07IUEihpMptMYflIDRkccWgf42vT/VL1Dl8Hw oCLA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=NjIRpbSd; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-171989-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171989-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d16-20020a637350000000b0061b9b645422si10121137pgn.722.2024.05.07.11.37.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 11:37:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171989-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=NjIRpbSd; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-171989-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171989-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 70FE9284A59 for ; Tue, 7 May 2024 18:37:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D40A16F0CB; Tue, 7 May 2024 18:36:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="NjIRpbSd" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A889316D9AC for ; Tue, 7 May 2024 18:36:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715106981; cv=none; b=ctIVZPzGTNsmvit5pyftXSmoSQKQACdF9pPabaMO62r1Uxn90zfB89NA/2pw1o+7w0T/P3RWpJnb8Mn4NGG72efDp1we44yZT1aZQAIkvODhRNIYB4PXsQOQn/0eLlpxoybzzU3BFqz8xSQvwKGuzDu03vihuwm4fz/KHJ79C5o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715106981; c=relaxed/simple; bh=gZJmDVMTmoK2/QwHo8/MRghD8LhtGoTrMfNAgjzgumw=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=e1sYk7lJRx/VOLFhPD+fq/V0432ZVqfV9jy7kiOzh/C3TPZETzpKGtPNpoTB9EV3pYVxnRYybwcheNjkMuIjn0/gvCZFdyB577WcMdG5/JEOAu19RzvDLM2ZvV7N3uKObKukQen4aQ36e5PI6U7YCBPUVF0GCGZ9PUCeFN5vlTQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=NjIRpbSd; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-61e0c296333so460917b3.1 for ; Tue, 07 May 2024 11:36:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715106978; x=1715711778; 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=4mOLkDwQHg5DuUlszkofmEYevyYYNPUsj80iyE8YhBY=; b=NjIRpbSdR1s11QSCZ9OR03EPePUlWkLg0qSyMW/kzGzQQHLsXfiIc9xQt/aqopPf9Y A0oxZtYEaT2+O9wPAMua2pBZ5xm7FqlZ8S1Hy442wc2uJ8d9CgKB3DJdx6SaCfSs5Mhh sMrWXBod5CjnbcvVCczh3m56zxD4U7qAZ1d5/99OIX2JNtGGipDQa8yUXhtUUgTx2J5j o6Enc8PjMX6zFi7ilCbv4BVioao1c6oVHe8gBqgSadt+UMpA0mK0m9/Z0VbrsiV6Vksz ct+tvIgYsAM5JYG7aJ8ADqPNBovx5BIIqsmjrg8g09zZQo3mjUCci9EJimpC6ODlMTva lHvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715106978; x=1715711778; 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=4mOLkDwQHg5DuUlszkofmEYevyYYNPUsj80iyE8YhBY=; b=IaqO7Pikaf2QLaWb7Dx/vLBYtaycupf4pakpVnF6LnGjOj6ZLxmGiKvx0Rgh9ba1fW XEPIsHWanVzcVQCdJdoCTFUoMw86weVvTudb/r+ngqseDLUFlDKUL4z8zhgu/QuScWNP F5fA9Qek3din/WkHewrGG2RmK3UUm9VHgE3zb8Gpm7czT8Cy+ME+bbGfcF3UmBdaEvDL NhkuIBqLaYjO+mVE0IJ8blFASzUCml2SuTSzbuxmlQQapa81M7QFRc5hfmwNGOkJyggn WpBFZB7hyqcvQFL2Yiv9bz+I30eB6gnzxck2jnAcI4yY4H1ShuQ7IN4qQ46D9Bjfr70E z2Cg== X-Forwarded-Encrypted: i=1; AJvYcCWeiJFXFJVtWJzJklWzNY11UxTldNcQHeMf1eILkiiCLl4bZ88lp+xy1yHHwUwsIbCeBrGrfP675NpbeobOdsDwyMr2o9jaljXXUaA+ X-Gm-Message-State: AOJu0Yz1kUrkRDjuw30Jg2CjdD9ACJ3V369gvLrlRhal4YFFJqF8jzGI Djc0mjmiw8GxXjaVj9CrFgKL2JUN4OJ+ge6823Dpnis3qtjjN/PIXgzZb66tB8fOg2DXhWD6JNr IOQS3aQ== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:8095:fd7:9773:b1df]) (user=irogers job=sendgmr) by 2002:a81:d203:0:b0:618:2ad1:a46f with SMTP id 00721157ae682-62076555c52mr8613587b3.2.1715106977741; Tue, 07 May 2024 11:36:17 -0700 (PDT) Date: Tue, 7 May 2024 11:35:43 -0700 In-Reply-To: <20240507183545.1236093-1-irogers@google.com> Message-Id: <20240507183545.1236093-7-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240507183545.1236093-1-irogers@google.com> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog Subject: [PATCH v1 6/8] perf mem-info: Move mem-info out of mem-events and symbol From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , Oliver Upton , James Clark , Tim Chen , Yicong Yang , K Prateek Nayak , Yanteng Si , Sun Haiyong , Kajol Jain , Ravi Bangoria , Li Dong , Paran Lee , Ben Gainey , Andi Kleen , Athira Rajeev , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Move mem-info to its own header rather than having it split between mem-events and symbol. Signed-off-by: Ian Rogers --- tools/perf/builtin-c2c.c | 1 + tools/perf/builtin-report.c | 1 + tools/perf/builtin-script.c | 1 + tools/perf/tests/mem.c | 1 + tools/perf/util/Build | 1 + tools/perf/util/hist.c | 1 + tools/perf/util/machine.c | 1 + tools/perf/util/mem-events.c | 16 +++++----- tools/perf/util/mem-events.h | 29 +++++++------------ tools/perf/util/mem-info.c | 28 ++++++++++++++++++ tools/perf/util/mem-info.h | 28 ++++++++++++++++++ .../scripting-engines/trace-event-python.c | 1 + tools/perf/util/sort.c | 1 + tools/perf/util/symbol.c | 26 +---------------- tools/perf/util/symbol.h | 12 -------- 15 files changed, 85 insertions(+), 63 deletions(-) create mode 100644 tools/perf/util/mem-info.c create mode 100644 tools/perf/util/mem-info.h diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 1f1d17df9b9a..c624414b2285 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -38,6 +38,7 @@ #include "ui/browsers/hists.h" #include "thread.h" #include "mem2node.h" +#include "mem-info.h" #include "symbol.h" #include "ui/ui.h" #include "ui/progress.h" diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index b5525f4f7090..6eb1d90b589f 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -31,6 +31,7 @@ #include "util/evsel.h" #include "util/evswitch.h" #include "util/header.h" +#include "util/mem-info.h" #include "util/session.h" #include "util/srcline.h" #include "util/tool.h" diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index f7c3c3868c3c..58af4f3aa592 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -32,6 +32,7 @@ #include "util/time-utils.h" #include "util/path.h" #include "util/event.h" +#include "util/mem-info.h" #include "ui/ui.h" #include "print_binary.h" #include "print_insn.h" diff --git a/tools/perf/tests/mem.c b/tools/perf/tests/mem.c index 56014ec7d49d..f694a60d8a73 100644 --- a/tools/perf/tests/mem.c +++ b/tools/perf/tests/mem.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include "util/map_symbol.h" #include "util/mem-events.h" +#include "util/mem-info.h" #include "util/symbol.h" #include "linux/perf_event.h" #include "util/debug.h" diff --git a/tools/perf/util/Build b/tools/perf/util/Build index 292170a99ab6..da64efd8718f 100644 --- a/tools/perf/util/Build +++ b/tools/perf/util/Build @@ -141,6 +141,7 @@ perf-y += term.o perf-y += help-unknown-cmd.o perf-y += dlfilter.o perf-y += mem-events.o +perf-y += mem-info.o perf-y += vsprintf.o perf-y += units.o perf-y += time-utils.o diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index b8a508cd0b14..56453a02cdf4 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -9,6 +9,7 @@ #include "map_symbol.h" #include "branch.h" #include "mem-events.h" +#include "mem-info.h" #include "session.h" #include "namespaces.h" #include "cgroup.h" diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index a3ff2ab154bd..d5a01ef92668 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -16,6 +16,7 @@ #include "map_symbol.h" #include "branch.h" #include "mem-events.h" +#include "mem-info.h" #include "path.h" #include "srcline.h" #include "symbol.h" diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c index 637cbd4a7bfb..f618a5ccc7af 100644 --- a/tools/perf/util/mem-events.c +++ b/tools/perf/util/mem-events.c @@ -10,7 +10,9 @@ #include #include "map_symbol.h" #include "mem-events.h" +#include "mem-info.h" #include "debug.h" +#include "evsel.h" #include "symbol.h" #include "pmu.h" #include "pmus.h" @@ -281,7 +283,7 @@ static const char * const tlb_access[] = { "Fault", }; -int perf_mem__tlb_scnprintf(char *out, size_t sz, struct mem_info *mem_info) +int perf_mem__tlb_scnprintf(char *out, size_t sz, const struct mem_info *mem_info) { size_t l = 0, i; u64 m = PERF_MEM_TLB_NA; @@ -359,7 +361,7 @@ static const char * const mem_hops[] = { "board", }; -static int perf_mem__op_scnprintf(char *out, size_t sz, struct mem_info *mem_info) +static int perf_mem__op_scnprintf(char *out, size_t sz, const struct mem_info *mem_info) { u64 op = PERF_MEM_LOCK_NA; int l; @@ -383,7 +385,7 @@ static int perf_mem__op_scnprintf(char *out, size_t sz, struct mem_info *mem_inf return l; } -int perf_mem__lvl_scnprintf(char *out, size_t sz, struct mem_info *mem_info) +int perf_mem__lvl_scnprintf(char *out, size_t sz, const struct mem_info *mem_info) { union perf_mem_data_src data_src; int printed = 0; @@ -465,7 +467,7 @@ static const char * const snoopx_access[] = { "Peer", }; -int perf_mem__snp_scnprintf(char *out, size_t sz, struct mem_info *mem_info) +int perf_mem__snp_scnprintf(char *out, size_t sz, const struct mem_info *mem_info) { size_t i, l = 0; u64 m = PERF_MEM_SNOOP_NA; @@ -507,7 +509,7 @@ int perf_mem__snp_scnprintf(char *out, size_t sz, struct mem_info *mem_info) return l; } -int perf_mem__lck_scnprintf(char *out, size_t sz, struct mem_info *mem_info) +int perf_mem__lck_scnprintf(char *out, size_t sz, const struct mem_info *mem_info) { u64 mask = PERF_MEM_LOCK_NA; int l; @@ -525,7 +527,7 @@ int perf_mem__lck_scnprintf(char *out, size_t sz, struct mem_info *mem_info) return l; } -int perf_mem__blk_scnprintf(char *out, size_t sz, struct mem_info *mem_info) +int perf_mem__blk_scnprintf(char *out, size_t sz, const struct mem_info *mem_info) { size_t l = 0; u64 mask = PERF_MEM_BLK_NA; @@ -548,7 +550,7 @@ int perf_mem__blk_scnprintf(char *out, size_t sz, struct mem_info *mem_info) return l; } -int perf_script__meminfo_scnprintf(char *out, size_t sz, struct mem_info *mem_info) +int perf_script__meminfo_scnprintf(char *out, size_t sz, const struct mem_info *mem_info) { int i = 0; diff --git a/tools/perf/util/mem-events.h b/tools/perf/util/mem-events.h index 15d5f0320d27..ca31014d7934 100644 --- a/tools/perf/util/mem-events.h +++ b/tools/perf/util/mem-events.h @@ -3,13 +3,7 @@ #define __PERF_MEM_EVENTS_H #include -#include -#include #include -#include -#include -#include "stat.h" -#include "evsel.h" struct perf_mem_event { bool record; @@ -21,13 +15,6 @@ struct perf_mem_event { const char *event_name; }; -struct mem_info { - struct addr_map_symbol iaddr; - struct addr_map_symbol daddr; - union perf_mem_data_src data_src; - refcount_t refcnt; -}; - enum { PERF_MEM_EVENTS__LOAD, PERF_MEM_EVENTS__STORE, @@ -35,6 +22,10 @@ enum { PERF_MEM_EVENTS__MAX, }; +struct evsel; +struct mem_info; +struct perf_pmu; + extern unsigned int perf_mem_events__loads_ldlat; extern struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX]; @@ -49,13 +40,13 @@ bool is_mem_loads_aux_event(struct evsel *leader); void perf_pmu__mem_events_list(struct perf_pmu *pmu); int perf_mem_events__record_args(const char **rec_argv, int *argv_nr); -int perf_mem__tlb_scnprintf(char *out, size_t sz, struct mem_info *mem_info); -int perf_mem__lvl_scnprintf(char *out, size_t sz, struct mem_info *mem_info); -int perf_mem__snp_scnprintf(char *out, size_t sz, struct mem_info *mem_info); -int perf_mem__lck_scnprintf(char *out, size_t sz, struct mem_info *mem_info); -int perf_mem__blk_scnprintf(char *out, size_t sz, struct mem_info *mem_info); +int perf_mem__tlb_scnprintf(char *out, size_t sz, const struct mem_info *mem_info); +int perf_mem__lvl_scnprintf(char *out, size_t sz, const struct mem_info *mem_info); +int perf_mem__snp_scnprintf(char *out, size_t sz, const struct mem_info *mem_info); +int perf_mem__lck_scnprintf(char *out, size_t sz, const struct mem_info *mem_info); +int perf_mem__blk_scnprintf(char *out, size_t sz, const struct mem_info *mem_info); -int perf_script__meminfo_scnprintf(char *bf, size_t size, struct mem_info *mem_info); +int perf_script__meminfo_scnprintf(char *bf, size_t size, const struct mem_info *mem_info); struct c2c_stats { u32 nr_entries; diff --git a/tools/perf/util/mem-info.c b/tools/perf/util/mem-info.c new file mode 100644 index 000000000000..ff0dfdb5369a --- /dev/null +++ b/tools/perf/util/mem-info.c @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include "mem-info.h" + +struct mem_info *mem_info__get(struct mem_info *mi) +{ + if (mi) + refcount_inc(&mi->refcnt); + return mi; +} + +void mem_info__put(struct mem_info *mi) +{ + if (mi && refcount_dec_and_test(&mi->refcnt)) { + addr_map_symbol__exit(&mi->iaddr); + addr_map_symbol__exit(&mi->daddr); + free(mi); + } +} + +struct mem_info *mem_info__new(void) +{ + struct mem_info *mi = zalloc(sizeof(*mi)); + + if (mi) + refcount_set(&mi->refcnt, 1); + return mi; +} diff --git a/tools/perf/util/mem-info.h b/tools/perf/util/mem-info.h new file mode 100644 index 000000000000..bb7d8375d73c --- /dev/null +++ b/tools/perf/util/mem-info.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __PERF_MEM_INFO_H +#define __PERF_MEM_INFO_H + +#include +#include +#include "map_symbol.h" + +struct mem_info { + struct addr_map_symbol iaddr; + struct addr_map_symbol daddr; + union perf_mem_data_src data_src; + refcount_t refcnt; +}; + +struct mem_info *mem_info__new(void); +struct mem_info *mem_info__get(struct mem_info *mi); +void mem_info__put(struct mem_info *mi); + +static inline void __mem_info__zput(struct mem_info **mi) +{ + mem_info__put(*mi); + *mi = NULL; +} + +#define mem_info__zput(mi) __mem_info__zput(&mi) + +#endif /* __PERF_MEM_INFO_H */ diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index c2caa5720299..c77fe08a0545 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c @@ -45,6 +45,7 @@ #include "../thread.h" #include "../comm.h" #include "../machine.h" +#include "../mem-info.h" #include "../db-export.h" #include "../thread-stack.h" #include "../trace-event.h" diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 704664e5b4ea..711ef69306f3 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -23,6 +23,7 @@ #include "strlist.h" #include "strbuf.h" #include "mem-events.h" +#include "mem-info.h" #include "annotate.h" #include "annotate-data.h" #include "event.h" diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 7772a4d3e66c..eb3319baa1b5 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -27,6 +27,7 @@ #include "symbol.h" #include "map_symbol.h" #include "mem-events.h" +#include "mem-info.h" #include "symsrc.h" #include "strlist.h" #include "intlist.h" @@ -2570,31 +2571,6 @@ int symbol__config_symfs(const struct option *opt __maybe_unused, return 0; } -struct mem_info *mem_info__get(struct mem_info *mi) -{ - if (mi) - refcount_inc(&mi->refcnt); - return mi; -} - -void mem_info__put(struct mem_info *mi) -{ - if (mi && refcount_dec_and_test(&mi->refcnt)) { - addr_map_symbol__exit(&mi->iaddr); - addr_map_symbol__exit(&mi->daddr); - free(mi); - } -} - -struct mem_info *mem_info__new(void) -{ - struct mem_info *mi = zalloc(sizeof(*mi)); - - if (mi) - refcount_set(&mi->refcnt, 1); - return mi; -} - /* * Checks that user supplied symbol kernel files are accessible because * the default mechanism for accessing elf files fails silently. i.e. if diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 071837ddce2a..3fb5d146d9b1 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h @@ -268,18 +268,6 @@ enum { SDT_NOTE_IDX_REFCTR, }; -struct mem_info *mem_info__new(void); -struct mem_info *mem_info__get(struct mem_info *mi); -void mem_info__put(struct mem_info *mi); - -static inline void __mem_info__zput(struct mem_info **mi) -{ - mem_info__put(*mi); - *mi = NULL; -} - -#define mem_info__zput(mi) __mem_info__zput(&mi) - int symbol__validate_sym_arguments(void); #endif /* __PERF_SYMBOL */ -- 2.45.0.rc1.225.g2a3ae87e7f-goog