Moving the following functions: cpu_map__get() cpu_map__put() to libperf with following names: perf_cpu_map__get() perf_cpu_map__put() Committer notes: Added fixes for arm/arm64
Unified · Split
| @@ -181,7 +181,7 @@ static int cs_etm_set_option(struct auxtrace_record *itr, · 180 unmodified lines | |||
| 181 | 181 | ||
| 182 | err = 0; | 182 | err = 0; |
| 183 | out: | 183 | out: |
| 184 | cpu_map__put(online_cpus); | 184 | perf_cpu_map__put(online_cpus); |
| 185 | return err; | 185 | return err; |
| 186 | } | 186 | } |
| 187 | 187 | ||
| @@ -517,7 +517,7 @@ cs_etm_info_priv_size(struct auxtrace_record *itr __maybe_unused, · 329 unmodified lines | |||
| 517 | } | 517 | } |
| 518 | } | 518 | } |
| 519 | 519 | ||
| 520 | cpu_map__put(online_cpus); | 520 | perf_cpu_map__put(online_cpus); |
| 521 | 521 | ||
| 522 | return (CS_ETM_HEADER_SIZE + | 522 | return (CS_ETM_HEADER_SIZE + |
| 523 | (etmv4 * CS_ETMV4_PRIV_SIZE) + | 523 | (etmv4 * CS_ETMV4_PRIV_SIZE) + |
| @@ -679,7 +679,7 @@ static int cs_etm_info_fill(struct auxtrace_record *itr, · 155 unmodified lines | |||
| 679 | if (cpu_map__has(cpu_map, i)) | 679 | if (cpu_map__has(cpu_map, i)) |
| 680 | cs_etm_get_metadata(i, &offset, itr, info); | 680 | cs_etm_get_metadata(i, &offset, itr, info); |
| 681 | 681 | ||
| 682 | cpu_map__put(online_cpus); | 682 | perf_cpu_map__put(online_cpus); |
| 683 | 683 | ||
| 684 | return 0; | 684 | return 0; |
| 685 | } | 685 | } |
| @@ -27,7 +27,7 @@ char *get_cpuid_str(struct perf_pmu *pmu) · 26 unmodified lines | |||
| 27 | return NULL; | 27 | return NULL; |
| 28 | 28 | ||
| 29 | /* read midr from list of cpus mapped to this pmu */ | 29 | /* read midr from list of cpus mapped to this pmu */ |
| 30 | cpus = cpu_map__get(pmu->cpus); | 30 | cpus = perf_cpu_map__get(pmu->cpus); |
| 31 | for (cpu = 0; cpu < cpus->nr; cpu++) { | 31 | for (cpu = 0; cpu < cpus->nr; cpu++) { |
| 32 | scnprintf(path, PATH_MAX, "%s/devices/system/cpu/cpu%d"MIDR, | 32 | scnprintf(path, PATH_MAX, "%s/devices/system/cpu/cpu%d"MIDR, |
| 33 | sysfs, cpus->map[cpu]); | 33 | sysfs, cpus->map[cpu]); |
| @@ -60,6 +60,6 @@ char *get_cpuid_str(struct perf_pmu *pmu) · 26 unmodified lines | |||
| 60 | buf = NULL; | 60 | buf = NULL; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | cpu_map__put(cpus); | 63 | perf_cpu_map__put(cpus); |
| 64 | return buf; | 64 | return buf; |
| 65 | } | 65 | } |
| @@ -206,7 +206,7 @@ static int reset_tracing_cpu(void) · 205 unmodified lines | |||
| 206 | int ret; | 206 | int ret; |
| 207 | 207 | ||
| 208 | ret = set_tracing_cpumask(cpumap); | 208 | ret = set_tracing_cpumask(cpumap); |
| 209 | cpu_map__put(cpumap); | 209 | perf_cpu_map__put(cpumap); |
| 210 | return ret; | 210 | return ret; |
| 211 | } | 211 | } |
| 212 | 212 | ||
| @@ -933,8 +933,8 @@ static int perf_stat_init_aggr_mode(void) · 932 unmodified lines | |||
| 933 | 933 | ||
| 934 | static void perf_stat__exit_aggr_mode(void) | 934 | static void perf_stat__exit_aggr_mode(void) |
| 935 | { | 935 | { |
| 936 | cpu_map__put(stat_config.aggr_map); | 936 | perf_cpu_map__put(stat_config.aggr_map); |
| 937 | cpu_map__put(stat_config.cpus_aggr_map); | 937 | perf_cpu_map__put(stat_config.cpus_aggr_map); |
| 938 | stat_config.aggr_map = NULL; | 938 | stat_config.aggr_map = NULL; |
| 939 | stat_config.cpus_aggr_map = NULL; | 939 | stat_config.cpus_aggr_map = NULL; |
| 940 | } | 940 | } |
| @@ -3,6 +3,8 @@ · 2 unmodified lines | |||
| 3 | #include <stdlib.h> | 3 | #include <stdlib.h> |
| 4 | #include <linux/refcount.h> | 4 | #include <linux/refcount.h> |
| 5 | #include <internal/cpumap.h> | 5 | #include <internal/cpumap.h> |
| 6 | #include <asm/bug.h> | ||
| 7 | #include <stdio.h> | ||
| 6 | 8 | ||
| 7 | struct perf_cpu_map *perf_cpu_map__dummy_new(void) | 9 | struct perf_cpu_map *perf_cpu_map__dummy_new(void) |
| 8 | { | 10 | { |
| @@ -16,3 +18,25 @@ struct perf_cpu_map *perf_cpu_map__dummy_new(void) · 7 unmodified lines | |||
| 16 | 18 | ||
| 17 | return cpus; | 19 | return cpus; |
| 18 | } | 20 | } |
| 21 | |||
| 22 | static void cpu_map__delete(struct perf_cpu_map *map) | ||
| 23 | { | ||
| 24 | if (map) { | ||
| 25 | WARN_ONCE(refcount_read(&map->refcnt) != 0, | ||
| 26 | "cpu_map refcnt unbalanced\n"); | ||
| 27 | free(map); | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | struct perf_cpu_map *perf_cpu_map__get(struct perf_cpu_map *map) | ||
| 32 | { | ||
| 33 | if (map) | ||
| 34 | refcount_inc(&map->refcnt); | ||
| 35 | return map; | ||
| 36 | } | ||
| 37 | |||
| 38 | void perf_cpu_map__put(struct perf_cpu_map *map) | ||
| 39 | { | ||
| 40 | if (map && refcount_dec_and_test(&map->refcnt)) | ||
| 41 | cpu_map__delete(map); | ||
| 42 | } | ||
| @@ -7,5 +7,7 @@ · 6 unmodified lines | |||
| 7 | struct perf_cpu_map; | 7 | struct perf_cpu_map; |
| 8 | 8 | ||
| 9 | LIBPERF_API struct perf_cpu_map *perf_cpu_map__dummy_new(void); | 9 | LIBPERF_API struct perf_cpu_map *perf_cpu_map__dummy_new(void); |
| 10 | LIBPERF_API struct perf_cpu_map *perf_cpu_map__get(struct perf_cpu_map *map); | ||
| 11 | LIBPERF_API void perf_cpu_map__put(struct perf_cpu_map *map); | ||
| 10 | 12 | ||
| 11 | #endif /* __LIBPERF_CPUMAP_H */ | 13 | #endif /* __LIBPERF_CPUMAP_H */ |
| @@ -2,6 +2,8 @@ LIBPERF_0.0.1 { · 1 unmodified line | |||
| 2 | global: | 2 | global: |
| 3 | libperf_set_print; | 3 | libperf_set_print; |
| 4 | perf_cpu_map__dummy_new; | 4 | perf_cpu_map__dummy_new; |
| 5 | perf_cpu_map__get; | ||
| 6 | perf_cpu_map__put; | ||
| 5 | local: | 7 | local: |
| 6 | *; | 8 | *; |
| 7 | }; | 9 | }; |
| @@ -21,7 +21,7 @@ static unsigned long *get_bitmap(const char *str, int nbits) · 20 unmodified lines | |||
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | if (map) | 23 | if (map) |
| 24 | cpu_map__put(map); | 24 | perf_cpu_map__put(map); |
| 25 | return bm; | 25 | return bm; |
| 26 | } | 26 | } |
| 27 | 27 | ||
| @@ -655,7 +655,7 @@ static int do_test_code_reading(bool try_kcore) · 654 unmodified lines | |||
| 655 | * and will be freed by following perf_evlist__set_maps | 655 | * and will be freed by following perf_evlist__set_maps |
| 656 | * call. Getting refference to keep them alive. | 656 | * call. Getting refference to keep them alive. |
| 657 | */ | 657 | */ |
| 658 | cpu_map__get(cpus); | 658 | perf_cpu_map__get(cpus); |
| 659 | thread_map__get(threads); | 659 | thread_map__get(threads); |
| 660 | perf_evlist__set_maps(evlist, NULL, NULL); | 660 | perf_evlist__set_maps(evlist, NULL, NULL); |
| 661 | evlist__delete(evlist); | 661 | evlist__delete(evlist); |
| @@ -705,7 +705,7 @@ out_err: · 43 unmodified lines | |||
| 705 | if (evlist) { | 705 | if (evlist) { |
| 706 | evlist__delete(evlist); | 706 | evlist__delete(evlist); |
| 707 | } else { | 707 | } else { |
| 708 | cpu_map__put(cpus); | 708 | perf_cpu_map__put(cpus); |
| 709 | thread_map__put(threads); | 709 | thread_map__put(threads); |
| 710 | } | 710 | } |
| 711 | machine__delete_threads(machine); | 711 | machine__delete_threads(machine); |
| @@ -39,7 +39,7 @@ static int process_event_mask(struct perf_tool *tool __maybe_unused, · 38 unmodified lines | |||
| 39 | TEST_ASSERT_VAL("wrong cpu", map->map[i] == i); | 39 | TEST_ASSERT_VAL("wrong cpu", map->map[i] == i); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | cpu_map__put(map); | 42 | perf_cpu_map__put(map); |
| 43 | return 0; | 43 | return 0; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| @@ -68,7 +68,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused, · 22 unmodified lines | |||
| 68 | TEST_ASSERT_VAL("wrong cpu", map->map[0] == 1); | 68 | TEST_ASSERT_VAL("wrong cpu", map->map[0] == 1); |
| 69 | TEST_ASSERT_VAL("wrong cpu", map->map[1] == 256); | 69 | TEST_ASSERT_VAL("wrong cpu", map->map[1] == 256); |
| 70 | TEST_ASSERT_VAL("wrong refcnt", refcount_read(&map->refcnt) == 1); | 70 | TEST_ASSERT_VAL("wrong refcnt", refcount_read(&map->refcnt) == 1); |
| 71 | cpu_map__put(map); | 71 | perf_cpu_map__put(map); |
| 72 | return 0; | 72 | return 0; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| @@ -83,7 +83,7 @@ int test__cpu_map_synthesize(struct test *test __maybe_unused, int subtest __may · 8 unmodified lines | |||
| 83 | TEST_ASSERT_VAL("failed to synthesize map", | 83 | TEST_ASSERT_VAL("failed to synthesize map", |
| 84 | !perf_event__synthesize_cpu_map(NULL, cpus, process_event_mask, NULL)); | 84 | !perf_event__synthesize_cpu_map(NULL, cpus, process_event_mask, NULL)); |
| 85 | 85 | ||
| 86 | cpu_map__put(cpus); | 86 | perf_cpu_map__put(cpus); |
| 87 | 87 | ||
| 88 | /* This one is better stores in cpu values. */ | 88 | /* This one is better stores in cpu values. */ |
| 89 | cpus = cpu_map__new("1,256"); | 89 | cpus = cpu_map__new("1,256"); |
| @@ -91,7 +91,7 @@ int test__cpu_map_synthesize(struct test *test __maybe_unused, int subtest __may · 1 unmodified line | |||
| 91 | TEST_ASSERT_VAL("failed to synthesize map", | 91 | TEST_ASSERT_VAL("failed to synthesize map", |
| 92 | !perf_event__synthesize_cpu_map(NULL, cpus, process_event_cpus, NULL)); | 92 | !perf_event__synthesize_cpu_map(NULL, cpus, process_event_cpus, NULL)); |
| 93 | 93 | ||
| 94 | cpu_map__put(cpus); | 94 | perf_cpu_map__put(cpus); |
| 95 | return 0; | 95 | return 0; |
| 96 | } | 96 | } |
| 97 | 97 | ||
| @@ -132,7 +132,7 @@ static int attach__cpu_disabled(struct evlist *evlist) · 131 unmodified lines | |||
| 132 | return err; | 132 | return err; |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | cpu_map__put(cpus); | 135 | perf_cpu_map__put(cpus); |
| 136 | return evsel__enable(evsel); | 136 | return evsel__enable(evsel); |
| 137 | } | 137 | } |
| 138 | 138 | ||
| @@ -154,7 +154,7 @@ static int attach__cpu_enabled(struct evlist *evlist) · 15 unmodified lines | |||
| 154 | if (err == -EACCES) | 154 | if (err == -EACCES) |
| 155 | return TEST_SKIP; | 155 | return TEST_SKIP; |
| 156 | 156 | ||
| 157 | cpu_map__put(cpus); | 157 | perf_cpu_map__put(cpus); |
| 158 | return err ? TEST_FAIL : TEST_OK; | 158 | return err ? TEST_FAIL : TEST_OK; |
| 159 | } | 159 | } |
| 160 | 160 | ||
| @@ -73,7 +73,7 @@ static int process_event_cpus(struct perf_tool *tool __maybe_unused, · 72 unmodified lines | |||
| 73 | TEST_ASSERT_VAL("wrong cpus", map->map[0] == 1); | 73 | TEST_ASSERT_VAL("wrong cpus", map->map[0] == 1); |
| 74 | TEST_ASSERT_VAL("wrong cpus", map->map[1] == 2); | 74 | TEST_ASSERT_VAL("wrong cpus", map->map[1] == 2); |
| 75 | TEST_ASSERT_VAL("wrong cpus", map->map[2] == 3); | 75 | TEST_ASSERT_VAL("wrong cpus", map->map[2] == 3); |
| 76 | cpu_map__put(map); | 76 | perf_cpu_map__put(map); |
| 77 | return 0; | 77 | return 0; |
| 78 | } | 78 | } |
| 79 | 79 | ||
| @@ -113,6 +113,6 @@ int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unu · 33 unmodified lines | |||
| 113 | TEST_ASSERT_VAL("failed to synthesize attr update cpus", | 113 | TEST_ASSERT_VAL("failed to synthesize attr update cpus", |
| 114 | !perf_event__synthesize_event_update_cpus(&tmp.tool, evsel, process_event_cpus)); | 114 | !perf_event__synthesize_event_update_cpus(&tmp.tool, evsel, process_event_cpus)); |
| 115 | 115 | ||
| 116 | cpu_map__put(evsel->own_cpus); | 116 | perf_cpu_map__put(evsel->own_cpus); |
| 117 | return 0; | 117 | return 0; |
| 118 | } | 118 | } |
| @@ -149,7 +149,7 @@ out_err: · 148 unmodified lines | |||
| 149 | evlist__disable(evlist); | 149 | evlist__disable(evlist); |
| 150 | evlist__delete(evlist); | 150 | evlist__delete(evlist); |
| 151 | } else { | 151 | } else { |
| 152 | cpu_map__put(cpus); | 152 | perf_cpu_map__put(cpus); |
| 153 | thread_map__put(threads); | 153 | thread_map__put(threads); |
| 154 | } | 154 | } |
| 155 | 155 | ||
| @@ -32,7 +32,7 @@ static unsigned long *get_bitmap(const char *str, int nbits) · 31 unmodified lines | |||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | if (map) | 34 | if (map) |
| 35 | cpu_map__put(map); | 35 | perf_cpu_map__put(map); |
| 36 | else | 36 | else |
| 37 | free(bm); | 37 | free(bm); |
| 38 | 38 | ||
| @@ -155,7 +155,7 @@ out_delete_evlist: · 154 unmodified lines | |||
| 155 | cpus = NULL; | 155 | cpus = NULL; |
| 156 | threads = NULL; | 156 | threads = NULL; |
| 157 | out_free_cpus: | 157 | out_free_cpus: |
| 158 | cpu_map__put(cpus); | 158 | perf_cpu_map__put(cpus); |
| 159 | out_free_threads: | 159 | out_free_threads: |
| 160 | thread_map__put(threads); | 160 | thread_map__put(threads); |
| 161 | return err; | 161 | return err; |
| @@ -120,7 +120,7 @@ out_close_fd: · 119 unmodified lines | |||
| 120 | out_evsel_delete: | 120 | out_evsel_delete: |
| 121 | evsel__delete(evsel); | 121 | evsel__delete(evsel); |
| 122 | out_cpu_map_delete: | 122 | out_cpu_map_delete: |
| 123 | cpu_map__put(cpus); | 123 | perf_cpu_map__put(cpus); |
| 124 | out_thread_map_delete: | 124 | out_thread_map_delete: |
| 125 | thread_map__put(threads); | 125 | thread_map__put(threads); |
| 126 | return err; | 126 | return err; |
| @@ -125,7 +125,7 @@ out_init: · 124 unmodified lines | |||
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | out_free_maps: | 127 | out_free_maps: |
| 128 | cpu_map__put(cpus); | 128 | perf_cpu_map__put(cpus); |
| 129 | thread_map__put(threads); | 129 | thread_map__put(threads); |
| 130 | out_delete_evlist: | 130 | out_delete_evlist: |
| 131 | evlist__delete(evlist); | 131 | evlist__delete(evlist); |
| @@ -569,7 +569,7 @@ out: · 568 unmodified lines | |||
| 569 | evlist__disable(evlist); | 569 | evlist__disable(evlist); |
| 570 | evlist__delete(evlist); | 570 | evlist__delete(evlist); |
| 571 | } else { | 571 | } else { |
| 572 | cpu_map__put(cpus); | 572 | perf_cpu_map__put(cpus); |
| 573 | thread_map__put(threads); | 573 | thread_map__put(threads); |
| 574 | } | 574 | } |
| 575 | 575 | ||
| @@ -135,7 +135,7 @@ out_init: · 134 unmodified lines | |||
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | out_free_maps: | 137 | out_free_maps: |
| 138 | cpu_map__put(cpus); | 138 | perf_cpu_map__put(cpus); |
| 139 | thread_map__put(threads); | 139 | thread_map__put(threads); |
| 140 | out_delete_evlist: | 140 | out_delete_evlist: |
| 141 | evlist__delete(evlist); | 141 | evlist__delete(evlist); |
| @@ -133,7 +133,7 @@ int test__session_topology(struct test *test __maybe_unused, int subtest __maybe · 132 unmodified lines | |||
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | ret = check_cpu_topology(path, map); | 135 | ret = check_cpu_topology(path, map); |
| 136 | cpu_map__put(map); | 136 | perf_cpu_map__put(map); |
| 137 | 137 | ||
| 138 | free_path: | 138 | free_path: |
| 139 | unlink(path); | 139 | unlink(path); |
| @@ -273,28 +273,6 @@ struct perf_cpu_map *cpu_map__empty_new(int nr) · 272 unmodified lines | |||
| 273 | return cpus; | 273 | return cpus; |
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | static void cpu_map__delete(struct perf_cpu_map *map) | ||
| 277 | { | ||
| 278 | if (map) { | ||
| 279 | WARN_ONCE(refcount_read(&map->refcnt) != 0, | ||
| 280 | "cpu_map refcnt unbalanced\n"); | ||
| 281 | free(map); | ||
| 282 | } | ||
| 283 | } | ||
| 284 | |||
| 285 | struct perf_cpu_map *cpu_map__get(struct perf_cpu_map *map) | ||
| 286 | { | ||
| 287 | if (map) | ||
| 288 | refcount_inc(&map->refcnt); | ||
| 289 | return map; | ||
| 290 | } | ||
| 291 | |||
| 292 | void cpu_map__put(struct perf_cpu_map *map) | ||
| 293 | { | ||
| 294 | if (map && refcount_dec_and_test(&map->refcnt)) | ||
| 295 | cpu_map__delete(map); | ||
| 296 | } | ||
| 297 | |||
| 298 | static int cpu__get_topology_int(int cpu, const char *name, int *value) | 276 | static int cpu__get_topology_int(int cpu, const char *name, int *value) |
| 299 | { | 277 | { |
| 300 | char path[PATH_MAX]; | 278 | char path[PATH_MAX]; |
| @@ -29,9 +29,6 @@ int cpu_map__build_die_map(struct perf_cpu_map *cpus, struct perf_cpu_map **diep · 28 unmodified lines | |||
| 29 | int cpu_map__build_core_map(struct perf_cpu_map *cpus, struct perf_cpu_map **corep); | 29 | int cpu_map__build_core_map(struct perf_cpu_map *cpus, struct perf_cpu_map **corep); |
| 30 | const struct perf_cpu_map *cpu_map__online(void); /* thread unsafe */ | 30 | const struct perf_cpu_map *cpu_map__online(void); /* thread unsafe */ |
| 31 | 31 | ||
| 32 | struct perf_cpu_map *cpu_map__get(struct perf_cpu_map *map); | ||
| 33 | void cpu_map__put(struct perf_cpu_map *map); | ||
| 34 | |||
| 35 | static inline int cpu_map__socket(struct perf_cpu_map *sock, int s) | 32 | static inline int cpu_map__socket(struct perf_cpu_map *sock, int s) |
| 36 | { | 33 | { |
| 37 | if (!sock || s > sock->nr || s < 0) | 34 | if (!sock || s > sock->nr || s < 0) |
| @@ -219,7 +219,7 @@ struct cpu_topology *cpu_topology__new(void) · 218 unmodified lines | |||
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | out_free: | 221 | out_free: |
| 222 | cpu_map__put(map); | 222 | perf_cpu_map__put(map); |
| 223 | if (ret) { | 223 | if (ret) { |
| 224 | cpu_topology__delete(tp); | 224 | cpu_topology__delete(tp); |
| 225 | tp = NULL; | 225 | tp = NULL; |
| @@ -335,7 +335,7 @@ struct numa_topology *numa_topology__new(void) · 109 unmodified lines | |||
| 335 | out: | 335 | out: |
| 336 | free(buf); | 336 | free(buf); |
| 337 | fclose(fp); | 337 | fclose(fp); |
| 338 | cpu_map__put(node_map); | 338 | perf_cpu_map__put(node_map); |
| 339 | return tp; | 339 | return tp; |
| 340 | } | 340 | } |
| 341 | 341 | ||
| @@ -179,7 +179,7 @@ void perf_env__exit(struct perf_env *env) · 178 unmodified lines | |||
| 179 | zfree(&env->cpu); | 179 | zfree(&env->cpu); |
| 180 | 180 | ||
| 181 | for (i = 0; i < env->nr_numa_nodes; i++) | 181 | for (i = 0; i < env->nr_numa_nodes; i++) |
| 182 | cpu_map__put(env->numa_nodes[i].map); | 182 | perf_cpu_map__put(env->numa_nodes[i].map); |
| 183 | zfree(&env->numa_nodes); | 183 | zfree(&env->numa_nodes); |
| 184 | 184 | ||
| 185 | for (i = 0; i < env->caches_cnt; i++) | 185 | for (i = 0; i < env->caches_cnt; i++) |
| @@ -1403,7 +1403,7 @@ size_t perf_event__fprintf_cpu_map(union perf_event *event, FILE *fp) · 1402 unmodified lines | |||
| 1403 | else | 1403 | else |
| 1404 | ret += fprintf(fp, "failed to get cpumap from event\n"); | 1404 | ret += fprintf(fp, "failed to get cpumap from event\n"); |
| 1405 | 1405 | ||
| 1406 | cpu_map__put(cpus); | 1406 | perf_cpu_map__put(cpus); |
| 1407 | return ret; | 1407 | return ret; |
| 1408 | } | 1408 | } |
| 1409 | 1409 | ||
| @@ -141,7 +141,7 @@ void evlist__delete(struct evlist *evlist) · 140 unmodified lines | |||
| 141 | 141 | ||
| 142 | perf_evlist__munmap(evlist); | 142 | perf_evlist__munmap(evlist); |
| 143 | evlist__close(evlist); | 143 | evlist__close(evlist); |
| 144 | cpu_map__put(evlist->cpus); | 144 | perf_cpu_map__put(evlist->cpus); |
| 145 | thread_map__put(evlist->threads); | 145 | thread_map__put(evlist->threads); |
| 146 | evlist->cpus = NULL; | 146 | evlist->cpus = NULL; |
| 147 | evlist->threads = NULL; | 147 | evlist->threads = NULL; |
| @@ -158,11 +158,11 @@ static void __perf_evlist__propagate_maps(struct evlist *evlist, · 10 unmodified lines | |||
| 158 | * keep it, if there's no target cpu list defined. | 158 | * keep it, if there's no target cpu list defined. |
| 159 | */ | 159 | */ |
| 160 | if (!evsel->own_cpus || evlist->has_user_cpus) { | 160 | if (!evsel->own_cpus || evlist->has_user_cpus) { |
| 161 | cpu_map__put(evsel->cpus); | 161 | perf_cpu_map__put(evsel->cpus); |
| 162 | evsel->cpus = cpu_map__get(evlist->cpus); | 162 | evsel->cpus = perf_cpu_map__get(evlist->cpus); |
| 163 | } else if (evsel->cpus != evsel->own_cpus) { | 163 | } else if (evsel->cpus != evsel->own_cpus) { |
| 164 | cpu_map__put(evsel->cpus); | 164 | perf_cpu_map__put(evsel->cpus); |
| 165 | evsel->cpus = cpu_map__get(evsel->own_cpus); | 165 | evsel->cpus = perf_cpu_map__get(evsel->own_cpus); |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | thread_map__put(evsel->threads); | 168 | thread_map__put(evsel->threads); |
| @@ -1115,8 +1115,8 @@ void perf_evlist__set_maps(struct evlist *evlist, struct perf_cpu_map *cpus, · 946 unmodified lines | |||
| 1115 | * the caller to increase the reference count. | 1115 | * the caller to increase the reference count. |
| 1116 | */ | 1116 | */ |
| 1117 | if (cpus != evlist->cpus) { | 1117 | if (cpus != evlist->cpus) { |
| 1118 | cpu_map__put(evlist->cpus); | 1118 | perf_cpu_map__put(evlist->cpus); |
| 1119 | evlist->cpus = cpu_map__get(cpus); | 1119 | evlist->cpus = perf_cpu_map__get(cpus); |
| 1120 | } | 1120 | } |
| 1121 | 1121 | ||
| 1122 | if (threads != evlist->threads) { | 1122 | if (threads != evlist->threads) { |
| @@ -1383,7 +1383,7 @@ static int perf_evlist__create_syswide_maps(struct evlist *evlist) · 260 unmodified lines | |||
| 1383 | out: | 1383 | out: |
| 1384 | return err; | 1384 | return err; |
| 1385 | out_put: | 1385 | out_put: |
| 1386 | cpu_map__put(cpus); | 1386 | perf_cpu_map__put(cpus); |
| 1387 | goto out; | 1387 | goto out; |
| 1388 | } | 1388 | } |
| 1389 | 1389 | ||
| @@ -1325,8 +1325,8 @@ void perf_evsel__exit(struct evsel *evsel) · 1324 unmodified lines | |||
| 1325 | perf_evsel__free_id(evsel); | 1325 | perf_evsel__free_id(evsel); |
| 1326 | perf_evsel__free_config_terms(evsel); | 1326 | perf_evsel__free_config_terms(evsel); |
| 1327 | cgroup__put(evsel->cgrp); | 1327 | cgroup__put(evsel->cgrp); |
| 1328 | cpu_map__put(evsel->cpus); | 1328 | perf_cpu_map__put(evsel->cpus); |
| 1329 | cpu_map__put(evsel->own_cpus); | 1329 | perf_cpu_map__put(evsel->own_cpus); |
| 1330 | thread_map__put(evsel->threads); | 1330 | thread_map__put(evsel->threads); |
| 1331 | zfree(&evsel->group_name); | 1331 | zfree(&evsel->group_name); |
| 1332 | zfree(&evsel->name); | 1332 | zfree(&evsel->name); |
| @@ -332,8 +332,8 @@ __add_event(struct list_head *list, int *idx, · 331 unmodified lines | |||
| 332 | return NULL; | 332 | return NULL; |
| 333 | 333 | ||
| 334 | (*idx)++; | 334 | (*idx)++; |
| 335 | evsel->cpus = cpu_map__get(cpus); | 335 | evsel->cpus = perf_cpu_map__get(cpus); |
| 336 | evsel->own_cpus = cpu_map__get(cpus); | 336 | evsel->own_cpus = perf_cpu_map__get(cpus); |
| 337 | evsel->system_wide = pmu ? pmu->is_uncore : false; | 337 | evsel->system_wide = pmu ? pmu->is_uncore : false; |
| 338 | evsel->auto_merge_stats = auto_merge_stats; | 338 | evsel->auto_merge_stats = auto_merge_stats; |
| 339 | 339 | ||
| @@ -626,7 +626,7 @@ static bool pmu_is_uncore(const char *name) · 625 unmodified lines | |||
| 626 | 626 | ||
| 627 | snprintf(path, PATH_MAX, CPUS_TEMPLATE_UNCORE, sysfs, name); | 627 | snprintf(path, PATH_MAX, CPUS_TEMPLATE_UNCORE, sysfs, name); |
| 628 | cpus = __pmu_cpumask(path); | 628 | cpus = __pmu_cpumask(path); |
| 629 | cpu_map__put(cpus); | 629 | perf_cpu_map__put(cpus); |
| 630 | 630 | ||
| 631 | return !!cpus; | 631 | return !!cpus; |
| 632 | } | 632 | } |
| @@ -557,7 +557,7 @@ static int pyrf_cpu_map__init(struct pyrf_cpu_map *pcpus, · 556 unmodified lines | |||
| 557 | 557 | ||
| 558 | static void pyrf_cpu_map__delete(struct pyrf_cpu_map *pcpus) | 558 | static void pyrf_cpu_map__delete(struct pyrf_cpu_map *pcpus) |
| 559 | { | 559 | { |
| 560 | cpu_map__put(pcpus->cpus); | 560 | perf_cpu_map__put(pcpus->cpus); |
| 561 | Py_TYPE(pcpus)->tp_free((PyObject*)pcpus); | 561 | Py_TYPE(pcpus)->tp_free((PyObject*)pcpus); |
| 562 | } | 562 | } |
| 563 | 563 | ||
| @@ -67,7 +67,7 @@ static bool perf_probe_api(setup_probe_fn_t fn) · 66 unmodified lines | |||
| 67 | if (!cpus) | 67 | if (!cpus) |
| 68 | return false; | 68 | return false; |
| 69 | cpu = cpus->map[0]; | 69 | cpu = cpus->map[0]; |
| 70 | cpu_map__put(cpus); | 70 | perf_cpu_map__put(cpus); |
| 71 | 71 | ||
| 72 | do { | 72 | do { |
| 73 | ret = perf_do_probe_api(fn, cpu, try[i++]); | 73 | ret = perf_do_probe_api(fn, cpu, try[i++]); |
| @@ -122,7 +122,7 @@ bool perf_can_record_cpu_wide(void) · 48 unmodified lines | |||
| 122 | if (!cpus) | 122 | if (!cpus) |
| 123 | return false; | 123 | return false; |
| 124 | cpu = cpus->map[0]; | 124 | cpu = cpus->map[0]; |
| 125 | cpu_map__put(cpus); | 125 | perf_cpu_map__put(cpus); |
| 126 | 126 | ||
| 127 | fd = sys_perf_event_open(&attr, -1, cpu, -1, 0); | 127 | fd = sys_perf_event_open(&attr, -1, cpu, -1, 0); |
| 128 | if (fd < 0) | 128 | if (fd < 0) |
| @@ -278,7 +278,7 @@ bool perf_evlist__can_select_event(struct evlist *evlist, const char *str) · 149 unmodified lines | |||
| 278 | struct perf_cpu_map *cpus = cpu_map__new(NULL); | 278 | struct perf_cpu_map *cpus = cpu_map__new(NULL); |
| 279 | 279 | ||
| 280 | cpu = cpus ? cpus->map[0] : 0; | 280 | cpu = cpus ? cpus->map[0] : 0; |
| 281 | cpu_map__put(cpus); | 281 | perf_cpu_map__put(cpus); |
| 282 | } else { | 282 | } else { |
| 283 | cpu = evlist->cpus->map[0]; | 283 | cpu = evlist->cpus->map[0]; |
| 284 | } | 284 | } |
| @@ -2310,7 +2310,7 @@ int perf_session__cpu_bitmap(struct perf_session *session, · 2309 unmodified lines | |||
| 2310 | err = 0; | 2310 | err = 0; |
| 2311 | 2311 | ||
| 2312 | out_delete_map: | 2312 | out_delete_map: |
| 2313 | cpu_map__put(map); | 2313 | perf_cpu_map__put(map); |
| 2314 | return err; | 2314 | return err; |
| 2315 | } | 2315 | } |
| 2316 | 2316 | ||
| @@ -745,7 +745,7 @@ static int str_to_bitmap(char *s, cpumask_t *b) · 744 unmodified lines | |||
| 745 | set_bit(c, cpumask_bits(b)); | 745 | set_bit(c, cpumask_bits(b)); |
| 746 | } | 746 | } |
| 747 | 747 | ||
| 748 | cpu_map__put(m); | 748 | perf_cpu_map__put(m); |
| 749 | 749 | ||
| 750 | return ret; | 750 | return ret; |
| 751 | } | 751 | } |