]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
perf annotate-data: Improve type comparison from different scopes
authorZecheng Li <zecheng@google.com>
Mon, 9 Mar 2026 17:55:17 +0000 (13:55 -0400)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 19 Mar 2026 21:42:29 +0000 (14:42 -0700)
commit69953f9c65856fc9438fc2ad4b9fd8255a2e47da
treec41d83987f53057b4b52d503a249b504d637a031
parent8b8d8b8f17dfa817e4e94ce4e8f26d92f6f65504
perf annotate-data: Improve type comparison from different scopes

When comparing types from different scopes, first compare their type
offsets. A larger offset means the field belongs to an outer (enclosing)
struct. This helps resolve cases where a pointer is found in an inner
scope, but a struct containing that pointer exists in an outer scope.
Previously, is_better_type would prefer the pointer type, but the struct
type is actually more complete and should be chosen.

Prefer types from outer scopes when is_better_type cannot determine a
better type. This is a heuristic for the case `struct A { struct B; }`
where A and B have the same size but I think in most cases A is in the
outer scope and should be preferred.

Signed-off-by: Zecheng Li <zecheng@google.com>
Signed-off-by: Zecheng Li <zli94@ncsu.edu>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/annotate-data.c