diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-08-02 17:18:28 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-08-02 17:18:28 -0400 |
commit | 076c6e45215aea0de1ed34d3d5079fabeaabf5e1 (patch) | |
tree | a07e78f58e625eb69dfda8f32ab46e5316551025 /tools/perf/util/map.h | |
parent | 3772b734720e1a3f2dc1d95cfdfaa5332f4ccf01 (diff) |
perf session: Free the ref_reloc_sym memory at the right place
Which is at perf_session__destroy_kernel_maps, counterpart to the
perf_session__create_kernel_maps where the kmap structure is located, just
after the vmlinux_maps.
Make it also check if the kernel maps were actually created, which may not
be the case if, for instance, perf_session__new can't complete due to
permission problems in, for instance, a 'perf report' case, when a
segfault will take place, that is how this was noticed.
The problem was introduced in d65a458, thus post .35.
This also adds code to release guest machines as them are also created
in perf_session__create_kernel_maps, so should be deleted on this newly
introduced counterpart, perf_session__destroy_kernel_maps.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/map.h')
-rw-r--r-- | tools/perf/util/map.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h index 0e0984e86fce..5b51bbd2f734 100644 --- a/tools/perf/util/map.h +++ b/tools/perf/util/map.h | |||
@@ -125,6 +125,7 @@ void map__reloc_vmlinux(struct map *self); | |||
125 | size_t __map_groups__fprintf_maps(struct map_groups *self, | 125 | size_t __map_groups__fprintf_maps(struct map_groups *self, |
126 | enum map_type type, int verbose, FILE *fp); | 126 | enum map_type type, int verbose, FILE *fp); |
127 | void maps__insert(struct rb_root *maps, struct map *map); | 127 | void maps__insert(struct rb_root *maps, struct map *map); |
128 | void maps__remove(struct rb_root *self, struct map *map); | ||
128 | struct map *maps__find(struct rb_root *maps, u64 addr); | 129 | struct map *maps__find(struct rb_root *maps, u64 addr); |
129 | void map_groups__init(struct map_groups *self); | 130 | void map_groups__init(struct map_groups *self); |
130 | void map_groups__exit(struct map_groups *self); | 131 | void map_groups__exit(struct map_groups *self); |
@@ -144,6 +145,7 @@ struct machine *machines__findnew(struct rb_root *self, pid_t pid); | |||
144 | char *machine__mmap_name(struct machine *self, char *bf, size_t size); | 145 | char *machine__mmap_name(struct machine *self, char *bf, size_t size); |
145 | int machine__init(struct machine *self, const char *root_dir, pid_t pid); | 146 | int machine__init(struct machine *self, const char *root_dir, pid_t pid); |
146 | void machine__exit(struct machine *self); | 147 | void machine__exit(struct machine *self); |
148 | void machine__delete(struct machine *self); | ||
147 | 149 | ||
148 | /* | 150 | /* |
149 | * Default guest kernel is defined by parameter --guestkallsyms | 151 | * Default guest kernel is defined by parameter --guestkallsyms |
@@ -165,6 +167,11 @@ static inline void map_groups__insert(struct map_groups *self, struct map *map) | |||
165 | map->groups = self; | 167 | map->groups = self; |
166 | } | 168 | } |
167 | 169 | ||
170 | static inline void map_groups__remove(struct map_groups *self, struct map *map) | ||
171 | { | ||
172 | maps__remove(&self->maps[map->type], map); | ||
173 | } | ||
174 | |||
168 | static inline struct map *map_groups__find(struct map_groups *self, | 175 | static inline struct map *map_groups__find(struct map_groups *self, |
169 | enum map_type type, u64 addr) | 176 | enum map_type type, u64 addr) |
170 | { | 177 | { |