]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
perf report: Use map_symbol__copy() when copying callchains
authorNamhyung Kim <namhyung@kernel.org>
Fri, 7 Mar 2025 06:12:49 +0000 (22:12 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Fri, 7 Mar 2025 22:06:56 +0000 (14:06 -0800)
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>
tools/perf/util/callchain.c

index 0c7564747a14e539f49fb47073730d763f1a826d..d7b7eef740b9d6edf725c8a32f65f98d48ae9b0f 100644 (file)
@@ -589,9 +589,7 @@ fill_node(struct callchain_node *node, struct callchain_cursor *cursor)
                        return -ENOMEM;
                }
                call->ip = cursor_node->ip;
-               call->ms = cursor_node->ms;
-               call->ms.map = map__get(call->ms.map);
-               call->ms.maps = maps__get(call->ms.maps);
+               map_symbol__copy(&call->ms, &cursor_node->ms);
                call->srcline = cursor_node->srcline;
 
                if (cursor_node->branch) {
@@ -1094,9 +1092,7 @@ int callchain_cursor_append(struct callchain_cursor *cursor,
 
        node->ip = ip;
        map_symbol__exit(&node->ms);
-       node->ms = *ms;
-       node->ms.maps = maps__get(ms->maps);
-       node->ms.map = map__get(ms->map);
+       map_symbol__copy(&node->ms, ms);
        node->branch = branch;
        node->nr_loop_iter = nr_loop_iter;
        node->iter_cycles = iter_cycles;
@@ -1564,7 +1560,7 @@ int callchain_node__make_parent_list(struct callchain_node *node)
                                goto out;
                        *new = *chain;
                        new->has_children = false;
-                       new->ms.map = map__get(new->ms.map);
+                       map_symbol__copy(&new->ms, &chain->ms);
                        list_add_tail(&new->list, &head);
                }
                parent = parent->parent;