Skip to content

Commit a8cd476

Browse files
captain5050acmel
authored andcommitted
perf cpumap: Remove refcnt from 'struct cpu_aggr_map'
It is assigned a value of 1 and never incremented. Remove and replace puts with delete. Signed-off-by: Ian Rogers <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Athira Rajeev <[email protected]> Cc: Ben Gainey <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: K Prateek Nayak <[email protected]> Cc: Kajol Jain <[email protected]> Cc: Kan Liang <[email protected]> Cc: Li Dong <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Oliver Upton <[email protected]> Cc: Paran Lee <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Ravi Bangoria <[email protected]> Cc: Sun Haiyong <[email protected]> Cc: Tim Chen <[email protected]> Cc: Yanteng Si <[email protected]> Cc: Yicong Yang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 557b32c commit a8cd476

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

tools/perf/builtin-stat.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,23 +1631,13 @@ static int perf_stat_init_aggr_mode(void)
16311631

16321632
static void cpu_aggr_map__delete(struct cpu_aggr_map *map)
16331633
{
1634-
if (map) {
1635-
WARN_ONCE(refcount_read(&map->refcnt) != 0,
1636-
"cpu_aggr_map refcnt unbalanced\n");
1637-
free(map);
1638-
}
1639-
}
1640-
1641-
static void cpu_aggr_map__put(struct cpu_aggr_map *map)
1642-
{
1643-
if (map && refcount_dec_and_test(&map->refcnt))
1644-
cpu_aggr_map__delete(map);
1634+
free(map);
16451635
}
16461636

16471637
static void perf_stat__exit_aggr_mode(void)
16481638
{
1649-
cpu_aggr_map__put(stat_config.aggr_map);
1650-
cpu_aggr_map__put(stat_config.cpus_aggr_map);
1639+
cpu_aggr_map__delete(stat_config.aggr_map);
1640+
cpu_aggr_map__delete(stat_config.cpus_aggr_map);
16511641
stat_config.aggr_map = NULL;
16521642
stat_config.cpus_aggr_map = NULL;
16531643
}

tools/perf/util/cpumap.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,6 @@ struct cpu_aggr_map *cpu_aggr_map__empty_new(int nr)
180180
cpus->nr = nr;
181181
for (i = 0; i < nr; i++)
182182
cpus->map[i] = aggr_cpu_id__empty();
183-
184-
refcount_set(&cpus->refcnt, 1);
185183
}
186184

187185
return cpus;

tools/perf/util/cpumap.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <stdbool.h>
66
#include <stdio.h>
77
#include <perf/cpumap.h>
8-
#include <linux/refcount.h>
98

109
/** Identify where counts are aggregated, -1 implies not to aggregate. */
1110
struct aggr_cpu_id {
@@ -37,7 +36,6 @@ struct aggr_cpu_id {
3736

3837
/** A collection of aggr_cpu_id values, the "built" version is sorted and uniqued. */
3938
struct cpu_aggr_map {
40-
refcount_t refcnt;
4139
/** Number of valid entries. */
4240
int nr;
4341
/** The entries. */

0 commit comments

Comments
 (0)