Re: [PATCH v1 0/3] Fix and improve __maps__fixup_overlap_and_insert

From: Ian Rogers
Date: Wed Jun 05 2024 - 19:55:51 EST


On Tue, May 21, 2024 at 9:51 AM Ian Rogers <irogers@xxxxxxxxxx> wrote:
>
> Fix latent unlikely bugs in __maps__fixup_overlap_and_insert.
>
> Improve __maps__fixup_overlap_and_insert's performance 21x in the case
> of overlapping mmaps. sesse@xxxxxxxxxx reported slowness opening
> perf.data files from chromium where the files contained a large number
> of overlapping mappings. Improve this case primarily by avoiding
> unnecessary sorting.
>
> Unscientific timing data processing a perf.data file with overlapping
> mmap events from chromium:
>
> Before:
> real 0m9.856s
> user 0m9.637s
> sys 0m0.204s
>
> After:
> real 0m0.675s
> user 0m0.454s
> sys 0m0.196s
>
> Tested with address/leak sanitizer, invariant checks and validating
> the before and after output are identical.
>
> Ian Rogers (3):
> perf maps: Fix use after free in __maps__fixup_overlap_and_insert
> perf maps: Reduce sorting for overlapping mappings
> perf maps: Add/use a sorted insert for fixup overlap and insert

Ping. Thanks,
Ian

> tools/perf/util/maps.c | 113 +++++++++++++++++++++++++++++++++--------
> 1 file changed, 92 insertions(+), 21 deletions(-)
>
> --
> 2.45.0.rc1.225.g2a3ae87e7f-goog
>