]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
perf: Tweak perf_event_attr::exclusive semantics
authorPeter Zijlstra <peterz@infradead.org>
Thu, 29 Oct 2020 15:32:22 +0000 (16:32 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 9 Nov 2020 17:12:36 +0000 (18:12 +0100)
Currently perf_event_attr::exclusive can be used to ensure an
event(group) is the sole group scheduled on the PMU. One consequence
is that when you have a pinned event (say the watchdog) you can no
longer have regular exclusive event(group)s.

Inspired by the fact that !pinned events are considered less strict,
allow !pinned,exclusive events to share the PMU with pinned,!exclusive
events.

Pinned,exclusive is still fully exclusive.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20201029162902.105962225@infradead.org
kernel/events/core.c

index 00be48acdc360b3e50df310de55773215489e238..dc568ca295bdc13122a5234779dd9a2010bc0b55 100644 (file)
@@ -2637,7 +2637,7 @@ static int group_can_go_on(struct perf_event *event,
         * If this group is exclusive and there are already
         * events on the CPU, it can't go on.
         */
-       if (event->attr.exclusive && cpuctx->active_oncpu)
+       if (event->attr.exclusive && !list_empty(get_event_list(event)))
                return 0;
        /*
         * Otherwise, try to add it if all previous groups were able