Skip to content

Commit db542b5

Browse files
committed
perf report: Use map_symbol__copy() when copying callchains
JIRA: https://issues.redhat.com/browse/RHEL-78197 upstream ======== commit e242df0 Author: Namhyung Kim <namhyung@kernel.org> Date: Thu Mar 6 22:12:49 2025 -0800 description =========== It seems there are places to miss updating refcount of maps. Let's use map_symbol__copy() helper to properly copy them with refcounts updated. Link: https://lore.kernel.org/r/20250307061250.320849-1-namhyung@kernel.org Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Michael Petlan <mpetlan@redhat.com>
1 parent 1867e29 commit db542b5

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

tools/perf/util/callchain.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -589,9 +589,7 @@ fill_node(struct callchain_node *node, struct callchain_cursor *cursor)
589589
return -ENOMEM;
590590
}
591591
call->ip = cursor_node->ip;
592-
call->ms = cursor_node->ms;
593-
call->ms.map = map__get(call->ms.map);
594-
call->ms.maps = maps__get(call->ms.maps);
592+
map_symbol__copy(&call->ms, &cursor_node->ms);
595593
call->srcline = cursor_node->srcline;
596594

597595
if (cursor_node->branch) {
@@ -1094,9 +1092,7 @@ int callchain_cursor_append(struct callchain_cursor *cursor,
10941092

10951093
node->ip = ip;
10961094
map_symbol__exit(&node->ms);
1097-
node->ms = *ms;
1098-
node->ms.maps = maps__get(ms->maps);
1099-
node->ms.map = map__get(ms->map);
1095+
map_symbol__copy(&node->ms, ms);
11001096
node->branch = branch;
11011097
node->nr_loop_iter = nr_loop_iter;
11021098
node->iter_cycles = iter_cycles;
@@ -1564,7 +1560,7 @@ int callchain_node__make_parent_list(struct callchain_node *node)
15641560
goto out;
15651561
*new = *chain;
15661562
new->has_children = false;
1567-
new->ms.map = map__get(new->ms.map);
1563+
map_symbol__copy(&new->ms, &chain->ms);
15681564
list_add_tail(&new->list, &head);
15691565
}
15701566
parent = parent->parent;

0 commit comments

Comments
 (0)