Skip to contentSkip to conversation

perf map: Check if the map still has some refcounts on exit

tip: perf/core tip-bot2 for Arnaldo Carvalho de Melo 1 participant 1 message Nov 12, 2019 1 message not in the archive perf events

lore
Share & tools
lore

tip-bot2 for Arnaldo Carvalho de Melo

author merge bot Applied
#1 lore raw
In reply to a message not in the archive

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     ee2555b612869a763563c5389ad789a52db0afd1
Gitweb:        https://git.kernel.org/tip/ee2555b612869a763563c5389ad789a52db0afd1
Author:        Arnaldo Carvalho de Melo <[email protected]>
AuthorDate:    Fri, 25 Oct 2019 15:14:50 -03:00
Committer:     Arnaldo Carvalho de Melo <[email protected]>
CommitterDate: Wed, 06 Nov 2019 15:43:06 -03:00

perf map: Check if the map still has some refcounts on exit

We were checking just if it was still on some rb tree, but that is not the only way that this map can still have references, map->refcnt is there exactly for this, use it.

---
 tools/perf/util/map.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/map.c +1 -1
index eec9b28..c9ba495 100644
@@ -288,7 +288,7 @@ bool map__has_symbols(const struct map *map)
 
 static void map__exit(struct map *map)
 {
-	BUG_ON(!RB_EMPTY_NODE(&map->rb_node));
+	BUG_ON(refcount_read(&map->refcnt) != 0);
 	dso__zput(map->dso);
 }