diff --git a/kernel/events/core.c b/kernel/events/core.c index b5a68d26f0b9..d22e4ba59dfa 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -1586,7 +1586,7 @@ perf_event_groups_less(struct perf_event *left, struct perf_event *right) */ return true; } - if (!right->cgrp || right->cgrp->css.cgroup) { + if (!right->cgrp || !right->cgrp->css.cgroup) { /* * Right has no cgroup but left does, no cgroups come * first.