perf core: Sharing events with multiple cgroups
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest2 patches 21 repliesIn review
- v22 patches 0 repliesSuperseded
- v1 RFC2 patches 13 repliesSuperseded
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | perf/core: Share an event with multiple cgroupsinclude/ include/ kernel/ | +477 | 21 replies | |
| 2/2 | perf/core: Support reading group events with shared cgroupskernel/ | +117 | 0 replies |
Reviews trailers per patch
All 2 patches have a Reviewed-by or Acked-by.
| Patch | Song Liu |
|---|---|
| 1/2 | A-b |
| 2/2 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 0/2] perf core: Sharing events with multiple cgroups
Hello,
This work is to make perf stat more scalable with a lot of cgroups.
Changes in V3)
* fix build error when !CONFIG_CGROUP_PERF
Changes in v2)
* use ____cacheline_aligned macro instead of the padding
* enclose the cgroup node list initialization
* add more comments
* add Acked-by from Song Liu
Currently we need to open a separate perf_event to count an event in a cgroup. For a big machine, this requires lots of events like
256 cpu x 8 events x 200 cgroups = 409600 events
This is very wasteful and not scalable. In this case, the perf stat actually counts exactly same events for each cgroup. I think we can just use a single event to measure all cgroups running on that cpu.
So I added new ioctl commands to add per-cgroup counters to an existing perf_event and to read the per-cgroup counters from the event. The per-cgroup counters are updated during the context switch if tasks' cgroups are different (and no need to change the HW PMU). It keeps the counters in a hash table with cgroup id as a key.
With this change, average processing time of my internal test workload which runs tasks in a different cgroup and communicates by pipes dropped from 11.3 usec to 5.8 usec.
Thanks,
Namhyung
Namhyung Kim (2):
perf/core: Share an event with multiple cgroups perf/core: Support reading group events with shared cgroups
include/linux/perf_event.h | 22 ++ include/uapi/linux/perf_event.h | 2 + kernel/events/core.c | 591 ++++++++++++++++++++++++++++++-- 3 files changed, 588 insertions(+), 27 deletions(-)
Signature · 18 lines
2.31.1.295.g9ea45b61b8-goog *** BLURB HERE *** Namhyung Kim (2): perf/core: Share an event with multiple cgroups perf/core: Support reading group events with shared cgroups include/linux/perf_event.h | 22 ++ include/uapi/linux/perf_event.h | 2 + kernel/events/core.c | 594 ++++++++++++++++++++++++++++++-- 3 files changed, 591 insertions(+), 27 deletions(-) base-commit: cface0326a6c2ae5c8f47bd466f07624b3e348a7 -- 2.31.1.295.g9ea45b61b8-goog