|
|
Log in / Subscribe / Register

Optimize cgroup context switch

From:  Ian Rogers <irogers-AT-google.com>
To:  Peter Zijlstra <peterz-AT-infradead.org>, Ingo Molnar <mingo-AT-redhat.com>, Arnaldo Carvalho de Melo <acme-AT-kernel.org>, Mark Rutland <mark.rutland-AT-arm.com>, Alexander Shishkin <alexander.shishkin-AT-linux.intel.com>, Jiri Olsa <jolsa-AT-redhat.com>, Namhyung Kim <namhyung-AT-kernel.org>, Andrew Morton <akpm-AT-linux-foundation.org>, Randy Dunlap <rdunlap-AT-infradead.org>, Masahiro Yamada <yamada.masahiro-AT-socionext.com>, Shuah Khan <skhan-AT-linuxfoundation.org>, Krzysztof Kozlowski <krzk-AT-kernel.org>, Kees Cook <keescook-AT-chromium.org>, "Paul E. McKenney" <paulmck-AT-kernel.org>, Masami Hiramatsu <mhiramat-AT-kernel.org>, Marco Elver <elver-AT-google.com>, Kent Overstreet <kent.overstreet-AT-gmail.com>, Andy Shevchenko <andriy.shevchenko-AT-linux.intel.com>, Ard Biesheuvel <ardb-AT-kernel.org>, Gary Hook <Gary.Hook-AT-amd.com>, Kan Liang <kan.liang-AT-linux.intel.com>, linux-kernel-AT-vger.kernel.org
Subject:  [PATCH v6 0/6] Optimize cgroup context switch
Date:  Thu, 13 Feb 2020 23:51:27 -0800
Message-ID:  <20200214075133.181299-1-irogers@google.com>
Cc:  Stephane Eranian <eranian-AT-google.com>, Andi Kleen <ak-AT-linux.intel.com>, Ian Rogers <irogers-AT-google.com>
Archive-link:  Article

Avoid iterating over all per-CPU events during cgroup changing context
switches by organizing events by cgroup.

To make an efficient set of iterators, introduce a min max heap
utility with test.

The v6 patch reduces the patch set by 4 patches, it updates the cgroup
id and fixes part of the min_heap rename from v5.

The v5 patch set renames min_max_heap to min_heap as suggested by
Peter Zijlstra, it also addresses comments around preferring
__always_inline over inline.

The v4 patch set addresses review comments on the v3 patch set by
Peter Zijlstra.

These patches include a caching algorithm to improve the search for
the first event in a group by Kan Liang <kan.liang@linux.intel.com> as
well as rebasing hit "optimize event_filter_match during sched_in"
from https://lkml.org/lkml/2019/8/7/771.

The v2 patch set was modified by Peter Zijlstra in his perf/cgroup
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/peterz/qu...

These patches follow Peter's reorganization and his fixes to the
perf_cpu_context min_heap storage code.

Ian Rogers (5):
  lib: introduce generic min-heap
  perf: Use min_heap in visit_groups_merge
  perf: Add per perf_cpu_context min_heap storage
  perf/cgroup: Grow per perf_cpu_context heap storage
  perf/cgroup: Order events in RB tree by cgroup id

Peter Zijlstra (1):
  perf/cgroup: Reorder perf_cgroup_connect()

 include/linux/min_heap.h   | 135 ++++++++++++++++++++
 include/linux/perf_event.h |   7 ++
 kernel/events/core.c       | 251 +++++++++++++++++++++++++++++++------
 lib/Kconfig.debug          |  10 ++
 lib/Makefile               |   1 +
 lib/test_min_heap.c        | 194 ++++++++++++++++++++++++++++
 6 files changed, 563 insertions(+), 35 deletions(-)
 create mode 100644 include/linux/min_heap.h
 create mode 100644 lib/test_min_heap.c

-- 
2.25.0.265.gbab2e86ba0-goog



Copyright © 2020, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds