Skip to content

perf: Allow closing siblings' file descriptors

Alexander Shishkin lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 18 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2perf: Add closing sibling events' file descriptorsinclude/linux/perf_event.h include/uapi/linux/perf_event.h kernel/events/core.c+115 -4214 replies
2/2perf record: Support closing siblings' file descriptorstools/include/uapi/linux/perf_event.h tools/lib/perf/evlist.c tools/lib/perf/evsel.c +6 more+119 -131 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] perf: Allow closing siblings' file descriptors

Hi guys,

I've been looking at reducing the number of open file descriptors per perf session. If we retain one descriptor per event, in a large group they add up. At the same time, we're not actually using them for anything after the SET_OUTPUT and maybe SET_FILTER ioctls. So, this series is a stab at that.

So, I added a new flag to the perf_event_open() that tells perf to keep the event around after its file descriptor gets closed, for as long as its group leader is alive. Since this is a new behavior, the flag is an opt-in.

I also hacked this into the perf tool (mostly perf record, but I'll hack stat as well if this general approach is agreeable).

Alexander Shishkin (2):
perf: Add closing sibling events' file descriptors perf record: Support closing siblings' file descriptors

 include/linux/perf_event.h              |   7 ++
 include/uapi/linux/perf_event.h         |   1 +
 kernel/events/core.c                    | 149 +++++++++++++++++-------
 tools/include/uapi/linux/perf_event.h   |   1 +
 tools/lib/perf/evlist.c                 |  30 ++++-
 tools/lib/perf/evsel.c                  |  21 ++++
 tools/lib/perf/include/internal/evsel.h |   4 +
 tools/perf/builtin-record.c             |  48 ++++++--
 tools/perf/util/cpumap.c                |   4 +
 tools/perf/util/evlist.c                |   4 +-
 tools/perf/util/evsel.c                 |  17 ++-
 tools/perf/util/evsel.h                 |   3 +
 12 files changed, 234 insertions(+), 55 deletions(-)
Signature · 1 line
2.27.0