lkml.org 
[lkml]   [2023]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH v4 27/53] perf maps: Fix up overlaps during fixup_end
From
Maps are sometimes made overlapping, in particular kernel maps. If the
end of a map overlaps the start of the next, shorten the overlapping
map. This should remove potential non-determinism in maps__find, ie
finding maps by address.

Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/util/maps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/maps.c b/tools/perf/util/maps.c
index 01c15d0b300a..fba95a00ecdf 100644
--- a/tools/perf/util/maps.c
+++ b/tools/perf/util/maps.c
@@ -700,7 +700,7 @@ void maps__fixup_end(struct maps *maps)
down_write(maps__lock(maps));

maps__for_each_entry(maps, curr) {
- if (prev != NULL && !map__end(prev->map))
+ if (prev && (!map__end(prev->map) || map__end(prev->map) > map__start(curr->map)))
map__set_end(prev->map, map__start(curr->map));

prev = curr;
--
2.42.0.869.gea05f2083d-goog
\
 
 \ /
  Last update: 2023-11-02 19:02    [W:0.510 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site