Skip to content

perf tools: Speedup DWARF unwind

Jiri Olsa lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest13 patches 1 replyIn review
  2. v313 patches 12 repliesSuperseded
  3. v214 patches 21 repliesSuperseded

Changes in v4 from the cover letter

- fixed changelog for patch 6 (David Ahern)
- added Reviewed-by from David Ahern for some patches
- other minor fixies pointed by David Ahern

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13perf tools: Cache register accesses for unwind processingtools/perf/util/event.h tools/perf/util/perf_regs.c tools/perf/util/perf_regs.h+17 -20 replies
2/13perf tools: Separate dso data related variablestools/perf/util/dso.c tools/perf/util/dso.h+10 -50 replies
3/13perf tools: Add data_fd into dso objecttools/perf/util/dso.c tools/perf/util/dso.h tools/perf/util/unwind-libunwind.c+24 -60 replies
4/13perf tools: Add global list of opened dso objectstools/perf/util/dso.c tools/perf/util/dso.h+40 -20 replies
5/13perf tools: Add global count of opened dso objectstools/perf/util/dso.c+7 -10 replies
6/13perf tools: Cache dso data file descriptortools/perf/util/dso.c tools/perf/util/unwind-libunwind.c+59 -40 replies
7/13perf tools: Add file size check and factor dso__data_read_offsettools/perf/util/dso.c tools/perf/util/dso.h+50 -150 replies
8/13perf tools: Allow to close dso fd in case of open failuretools/perf/util/dso.c+22 -10 replies
9/13perf tools: Add dso__data_* interface descriptonstools/perf/util/dso.c tools/perf/util/dso.h+97 -00 replies
10/13perf tests: Spawn child for each testtools/perf/tests/builtin-test.c+31 -10 replies
11/13perf tests: Allow reuse of test_file functiontools/perf/tests/dso-data.c+5 -10 replies
12/13perf tests: Add test for caching dso file descriptorstools/perf/tests/builtin-test.c tools/perf/tests/dso-data.c tools/perf/tests/tests.h+138 -40 replies
13/13perf tests: Add test for closing dso objects on EMFILE errortools/perf/tests/builtin-test.c tools/perf/tests/dso-data.c tools/perf/tests/tests.h+78 -00 replies

Reviews trailers per patch

1 of 13 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchDavid AhernNamhyung Kim
SeriesA-b
1/13
2/13
3/13
4/13
5/13
6/13
7/13
8/13
9/13
10/13R-b
11/13
12/13
13/13

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCHv4 00/13] perf tools: Speedup DWARF unwind

hi,
trying to speedup DWARF unwind report code by factoring related code:
- caching sample's registers access
- keep dso data file descriptor open for the life of the dso object
- replace dso cache code by mapping dso data file directly for the life of the dso object

The speedup is mainly for libunwind unwind. The libdw will benefit mainly from cached registers access, because it handles dso data accesses by itself.. and anyway it's still faster ;-).

On ~11GB perf data file with dwarf unwind data I've got around 30% speed up.

I've also got possitive test feedback from Jean Pihet:
https://wiki.linaro.org/LEG/Engineering/TOOLS/perf-callstack-unwinding#Speed_improvement

v4 changes:
- fixed changelog for patch 6 (David Ahern)
- added Reviewed-by from David Ahern for some patches
- other minor fixies pointed by David Ahern

v3 changes:
- moved the cache logic into dso__data_fd (Namhyung Kim)
- omited test_dso_data__fd_limit variable,
dso data cache test changed accordingly (Namhyung Kim)
- several small fixies from review (Namhyung Kim)

v2 changes:
- adding limit for open dso objects with sort of LRU mechanism to pick up and close dso objects if we are over the limit
- file mmaping changes are omitted, because I couldn't prove the improvement exactly, will resubmit later
- added dso close logic in case of no memory
- added tests

Also reachable in here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/core_unwind_speedup

thanks,
jirka

Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Corey Ashford <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jean Pihet <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>

---
Jiri Olsa (13):
perf tools: Cache register accesses for unwind processing perf tools: Separate dso data related variables
perf tools: Add data_fd into dso object
perf tools: Add global list of opened dso objects perf tools: Add global count of opened dso objects perf tools: Cache dso data file descriptor
perf tools: Add file size check and factor dso__data_read_offset perf tools: Allow to close dso fd in case of open failure perf tools: Add dso__data_* interface descriptons perf tests: Spawn child for each test
perf tests: Allow reuse of test_file function
perf tests: Add test for caching dso file descriptors perf tests: Add test for closing dso objects on EMFILE error

 tools/perf/tests/builtin-test.c    |  42 ++++++++++++++-
 tools/perf/tests/dso-data.c        | 214 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 tools/perf/tests/tests.h           |   2 +
 tools/perf/util/dso.c              | 279 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------
 tools/perf/util/dso.h              |  50 +++++++++++++++++-
 tools/perf/util/event.h            |   5 ++
 tools/perf/util/perf_regs.c        |  10 +++-
 tools/perf/util/perf_regs.h        |   4 +-
 tools/perf/util/unwind-libunwind.c |   2 -
 9 files changed, 572 insertions(+), 36 deletions(-)