linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 -tip 0/7] tools/perf: Update rbtree implementation and optimize users
@ 2018-12-06 19:18 Davidlohr Bueso
  2018-12-06 19:18 ` [PATCH 1/7] tools/perf: Update rbtree implementation Davidlohr Bueso
                   ` (6 more replies)
  0 siblings, 7 replies; 18+ messages in thread
From: Davidlohr Bueso @ 2018-12-06 19:18 UTC (permalink / raw)
  To: acme; +Cc: mingo, linux-kernel, dave

Hi,

Per acme's request, this is a rebase (and basically rewrite) of v1.

The following optimizes the rb_first() lookups in perf tooling such that we
can avoid walking down the tree finding the first element. Tree traversals
(and overall computing the first node in the tree) is a surprisingly common
operation. On a Xeon E5-2450 @ 2.10GHz, the cost of an rb_first() was ~60 cycles
for 100 nodes, and ~75 cycles with 1000 nodes.

The first patch adds the updated implementation of rbtrees, including the
cached interfaces, taken from the kernel. The rest of the patches make use
of this for the users I thought might care the most.

With these patches I am able to build and use perf without anything going wrong
(but needs more testing no doubt, as changes while redundant can be a little tricky
depending on if the user get smart about the trees). I'm sorry if some patches
seem too big, I've tried to split them the best I could.

Applies on today's -tip tree. Please consider for v4.21.

Thanks!

Davidlohr Bueso (7):
  tools/perf: Update rbtree implementation
  perf machine: Use cached rbtrees
  perf callchain: Use cached rbtrees
  perf util: Use cached rbtree for rblists
  perf symbols: Use cached rbtrees
  perf hist: Use cached rbtrees
  perf sched: Use cached rbtrees

 tools/include/linux/rbtree.h           |  52 ++++++++-
 tools/include/linux/rbtree_augmented.h |  60 ++++++++--
 tools/lib/rbtree.c                     | 178 ++++++++++++++++++++++-------
 tools/perf/builtin-annotate.c          |   4 +-
 tools/perf/builtin-c2c.c               |   6 +-
 tools/perf/builtin-diff.c              |  10 +-
 tools/perf/builtin-report.c            |   3 +-
 tools/perf/builtin-sched.c             |  45 ++++----
 tools/perf/builtin-top.c               |   2 +-
 tools/perf/tests/hists_common.c        |   8 +-
 tools/perf/tests/hists_cumulate.c      |  14 +--
 tools/perf/tests/hists_link.c          |   8 +-
 tools/perf/tests/hists_output.c        |  32 +++---
 tools/perf/ui/browsers/hists.c         |   6 +-
 tools/perf/ui/gtk/hists.c              |   4 +-
 tools/perf/ui/stdio/hist.c             |   3 +-
 tools/perf/util/build-id.c             |  12 +-
 tools/perf/util/dso.c                  |   8 +-
 tools/perf/util/dso.h                  |  10 +-
 tools/perf/util/hist.c                 | 199 +++++++++++++++++++--------------
 tools/perf/util/hist.h                 |  10 +-
 tools/perf/util/intlist.h              |   2 +-
 tools/perf/util/machine.c              |  53 +++++----
 tools/perf/util/machine.h              |  12 +-
 tools/perf/util/map.c                  |   8 +-
 tools/perf/util/metricgroup.c          |   2 +-
 tools/perf/util/probe-event.c          |   3 +-
 tools/perf/util/rb_resort.h            |   8 +-
 tools/perf/util/rblist.c               |  28 +++--
 tools/perf/util/rblist.h               |   2 +-
 tools/perf/util/sort.h                 |   4 +-
 tools/perf/util/srcline.c              |  43 ++++---
 tools/perf/util/srcline.h              |  13 ++-
 tools/perf/util/stat-shadow.c          |   2 +-
 tools/perf/util/strlist.h              |   2 +-
 tools/perf/util/symbol.c               |  87 +++++++-------
 tools/perf/util/symbol.h               |  13 ++-
 tools/perf/util/symbol_fprintf.c       |   2 +-
 38 files changed, 598 insertions(+), 360 deletions(-)

-- 
2.16.4


^ permalink raw reply	[flat|nested] 18+ messages in thread
* [PATCH -tip 0/7] tools/perf: Update rbtree implementation and optimize users
@ 2017-11-27  2:30 Davidlohr Bueso
  2017-11-27  2:30 ` [PATCH 7/7] perf sched: Use cached rbtrees Davidlohr Bueso
  0 siblings, 1 reply; 18+ messages in thread
From: Davidlohr Bueso @ 2017-11-27  2:30 UTC (permalink / raw)
  To: acme; +Cc: jolsa, ak, mingo, dave, linux-kernel

Hi,

The following optimizes the rb_first() lookups in perf tooling such that we
can avoid walking down the tree finding the first element. Tree traversals
(and overall computing the first node in the tree) is a surprisingly common
operation.

The first patch adds the updated implementation of rbtrees, including the
cached interfaces, taken from the kernel. The rest of the patches make use
of this for the users I thought might care the most.

With these patches I am able to build and use perf without anything going wrong
(but needs more testing no doubt, as changes while redundant can be a little tricky
depending on if the user get smart about the trees). I'm sorry if some patches
seem too big, I've tried to split them the best I could.

Applies on today's -tip tree. Please consider for v4.16.

Thanks!

Davidlohr Bueso (7):
  tools/perf: Update rbtree implementation
  perf machine: Use cached rbtrees
  perf callchain: Use cached rbtrees
  perf util: Use cached rbtree for rblists
  perf symbols: Use cached rbtrees
  perf hist: Use cached rbtrees
  perf sched: Use cached rbtrees

 tools/include/linux/rbtree.h           |  50 ++++++++-
 tools/include/linux/rbtree_augmented.h |  60 ++++++++--
 tools/lib/rbtree.c                     | 171 ++++++++++++++++++++--------
 tools/perf/builtin-annotate.c          |   4 +-
 tools/perf/builtin-c2c.c               |   6 +-
 tools/perf/builtin-diff.c              |  10 +-
 tools/perf/builtin-report.c            |   2 +-
 tools/perf/builtin-sched.c             |  45 ++++----
 tools/perf/builtin-top.c               |   6 +-
 tools/perf/tests/hists_common.c        |   8 +-
 tools/perf/tests/hists_cumulate.c      |  19 ++--
 tools/perf/tests/hists_link.c          |   8 +-
 tools/perf/tests/hists_output.c        |  32 +++---
 tools/perf/tests/vmlinux-kallsyms.c    |   3 +-
 tools/perf/ui/browsers/hists.c         |  16 +--
 tools/perf/ui/gtk/hists.c              |   6 +-
 tools/perf/ui/stdio/hist.c             |   3 +-
 tools/perf/util/build-id.c             |  12 +-
 tools/perf/util/dso.c                  |   7 +-
 tools/perf/util/dso.h                  |   6 +-
 tools/perf/util/hist.c                 | 198 ++++++++++++++++++---------------
 tools/perf/util/hist.h                 |  10 +-
 tools/perf/util/intlist.h              |   2 +-
 tools/perf/util/machine.c              |  52 +++++----
 tools/perf/util/machine.h              |   4 +-
 tools/perf/util/map.c                  |   8 +-
 tools/perf/util/metricgroup.c          |   2 +-
 tools/perf/util/probe-event.c          |   3 +-
 tools/perf/util/rblist.c               |  30 +++--
 tools/perf/util/rblist.h               |   2 +-
 tools/perf/util/sort.h                 |   4 +-
 tools/perf/util/srcline.c              |  21 ++--
 tools/perf/util/srcline.h              |   6 +-
 tools/perf/util/stat-shadow.c          |   2 +-
 tools/perf/util/strlist.h              |   2 +-
 tools/perf/util/symbol.c               |  85 +++++++-------
 tools/perf/util/symbol.h               |  12 +-
 tools/perf/util/symbol_fprintf.c       |   3 +-
 38 files changed, 570 insertions(+), 350 deletions(-)

-- 
2.13.6

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2019-01-26 10:05 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-06 19:18 [PATCH v2 -tip 0/7] tools/perf: Update rbtree implementation and optimize users Davidlohr Bueso
2018-12-06 19:18 ` [PATCH 1/7] tools/perf: Update rbtree implementation Davidlohr Bueso
2019-01-26 10:01   ` [tip:perf/core] tools: " tip-bot for Davidlohr Bueso
2018-12-06 19:18 ` [PATCH 2/7] perf machine: Use cached rbtrees Davidlohr Bueso
2019-01-26 10:01   ` [tip:perf/core] " tip-bot for Davidlohr Bueso
2018-12-06 19:18 ` [PATCH 3/7] perf callchain: " Davidlohr Bueso
2019-01-26 10:02   ` [tip:perf/core] " tip-bot for Davidlohr Bueso
2018-12-06 19:18 ` [PATCH 4/7] perf util: Use cached rbtree for rblists Davidlohr Bueso
2019-01-26 10:03   ` [tip:perf/core] " tip-bot for Davidlohr Bueso
2018-12-06 19:18 ` [PATCH 5/7] perf symbols: Use cached rbtrees Davidlohr Bueso
2019-01-26 10:03   ` [tip:perf/core] " tip-bot for Davidlohr Bueso
2018-12-06 19:18 ` [PATCH 6/7] perf hist: " Davidlohr Bueso
2019-01-22 13:59   ` Arnaldo Carvalho de Melo
2019-01-22 15:22     ` Davidlohr Bueso
2019-01-26 10:04   ` [tip:perf/core] " tip-bot for Davidlohr Bueso
2018-12-06 19:18 ` [PATCH 7/7] perf sched: " Davidlohr Bueso
2019-01-26 10:05   ` [tip:perf/core] " tip-bot for Davidlohr Bueso
  -- strict thread matches above, loose matches on Subject: below --
2017-11-27  2:30 [PATCH -tip 0/7] tools/perf: Update rbtree implementation and optimize users Davidlohr Bueso
2017-11-27  2:30 ` [PATCH 7/7] perf sched: Use cached rbtrees Davidlohr Bueso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).