summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2024-05-07 11:35:40 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2024-05-07 18:06:44 -0300
commit557b32c343925dfac480ef331494437ea223932d (patch)
treec01b86b67c5289c178529b1ec57874715983a2da /tools
parenta3f7768bcf48281df14d98715f076c5656571527 (diff)
downloadlinux-stable-557b32c343925dfac480ef331494437ea223932d.tar.gz
linux-stable-557b32c343925dfac480ef331494437ea223932d.tar.bz2
linux-stable-557b32c343925dfac480ef331494437ea223932d.zip
perf block-info: Remove unused refcount
block_info__get() has no callers so the refcount is only ever one. As such remove the reference counting logic and turn puts to deletes. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Cc: Ben Gainey <ben.gainey@arm.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: K Prateek Nayak <kprateek.nayak@amd.com> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Li Dong <lidong@vivo.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Oliver Upton <oliver.upton@linux.dev> Cc: Paran Lee <p4ranlee@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: Sun Haiyong <sunhaiyong@loongson.cn> Cc: Tim Chen <tim.c.chen@linux.intel.com> Cc: Yanteng Si <siyanteng@loongson.cn> Cc: Yicong Yang <yangyicong@hisilicon.com> Link: https://lore.kernel.org/r/20240507183545.1236093-4-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/block-info.c22
-rw-r--r--tools/perf/util/block-info.h15
-rw-r--r--tools/perf/util/hist.c4
3 files changed, 8 insertions, 33 deletions
diff --git a/tools/perf/util/block-info.c b/tools/perf/util/block-info.c
index 895ee8adf3b3..04068d48683f 100644
--- a/tools/perf/util/block-info.c
+++ b/tools/perf/util/block-info.c
@@ -43,26 +43,14 @@ static struct block_header_column {
}
};
-struct block_info *block_info__get(struct block_info *bi)
-{
- if (bi)
- refcount_inc(&bi->refcnt);
- return bi;
-}
-
-void block_info__put(struct block_info *bi)
+struct block_info *block_info__new(void)
{
- if (bi && refcount_dec_and_test(&bi->refcnt))
- free(bi);
+ return zalloc(sizeof(struct block_info));
}
-struct block_info *block_info__new(void)
+void block_info__delete(struct block_info *bi)
{
- struct block_info *bi = zalloc(sizeof(*bi));
-
- if (bi)
- refcount_set(&bi->refcnt, 1);
- return bi;
+ free(bi);
}
int64_t __block_info__cmp(struct hist_entry *left, struct hist_entry *right)
@@ -148,7 +136,7 @@ int block_info__process_sym(struct hist_entry *he, struct block_hist *bh,
he_block = hists__add_entry_block(&bh->block_hists,
&al, bi);
if (!he_block) {
- block_info__put(bi);
+ block_info__delete(bi);
return -1;
}
}
diff --git a/tools/perf/util/block-info.h b/tools/perf/util/block-info.h
index 96f53e89795e..0b9e1aad4c55 100644
--- a/tools/perf/util/block-info.h
+++ b/tools/perf/util/block-info.h
@@ -3,7 +3,6 @@
#define __PERF_BLOCK_H
#include <linux/types.h>
-#include <linux/refcount.h>
#include "hist.h"
#include "symbol.h"
#include "sort.h"
@@ -19,7 +18,6 @@ struct block_info {
u64 total_cycles;
int num;
int num_aggr;
- refcount_t refcnt;
};
struct block_fmt {
@@ -48,19 +46,8 @@ struct block_report {
int nr_fmts;
};
-struct block_hist;
-
struct block_info *block_info__new(void);
-struct block_info *block_info__get(struct block_info *bi);
-void block_info__put(struct block_info *bi);
-
-static inline void __block_info__zput(struct block_info **bi)
-{
- block_info__put(*bi);
- *bi = NULL;
-}
-
-#define block_info__zput(bi) __block_info__zput(&bi)
+void block_info__delete(struct block_info *bi);
int64_t __block_info__cmp(struct hist_entry *left, struct hist_entry *right);
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 55ea6afcc437..b8a508cd0b14 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -631,7 +631,7 @@ static struct hist_entry *hists__findnew_entry(struct hists *hists,
*/
mem_info__zput(entry->mem_info);
- block_info__zput(entry->block_info);
+ block_info__delete(entry->block_info);
kvm_info__zput(entry->kvm_info);
@@ -1341,7 +1341,7 @@ void hist_entry__delete(struct hist_entry *he)
}
if (he->block_info)
- block_info__zput(he->block_info);
+ block_info__delete(he->block_info);
if (he->kvm_info)
kvm_info__zput(he->kvm_info);