mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
perf tools: Initialize reference counts in map__clone()
Map clone was written before we introduced reference counts for maps and dsos, so all that was needed was just a copy and then we would insert it into the new map_groups instance. Fix it by, after copying, initializing the map->refcnt, grabbing a struct dso refcount and resetting pointers that may be used to determine if a map, when deleted, is in a rb_tree. Cc: Adrian Hunter <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: David Ahern <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
parent
4b715d24f4
commit
66671d001a
1 changed files with 11 additions and 2 deletions
|
|
@ -348,9 +348,18 @@ struct symbol *map__find_symbol_by_name(struct map *map, const char *name,
|
|||
return dso__find_symbol_by_name(map->dso, map->type, name);
|
||||
}
|
||||
|
||||
struct map *map__clone(struct map *map)
|
||||
struct map *map__clone(struct map *from)
|
||||
{
|
||||
return memdup(map, sizeof(*map));
|
||||
struct map *map = memdup(from, sizeof(*map));
|
||||
|
||||
if (map != NULL) {
|
||||
atomic_set(&map->refcnt, 1);
|
||||
RB_CLEAR_NODE(&map->rb_node);
|
||||
dso__get(map->dso);
|
||||
map->groups = NULL;
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
int map__overlap(struct map *l, struct map *r)
|
||||
|
|
|
|||
Loading…
Reference in a new issue