Re: [PATCH 2/7] perf/cgroup: order events in RB tree by cgroup id

From: Peter Zijlstra
Date: Mon Jul 08 2019 - 11:45:42 EST


On Mon, Jul 01, 2019 at 11:59:50PM -0700, Ian Rogers wrote:
> +perf_event_groups_first(struct perf_event_groups *groups, int cpu,
> + struct cgroup *cgrp)
> {
> struct perf_event *node_event = NULL, *match = NULL;
> struct rb_node *node = groups->tree.rb_node;
> +#ifdef CONFIG_CGROUP_PERF
> + int node_cgrp_id, cgrp_id = 0;
> +
> + if (cgrp)
> + cgrp_id = cgrp->id;
> +#endif

Is 0 ever a valid cgroup.id ? If so, should we perhaps use -1 to denote
'none' ? Ether way around a little comment here couldn't hurt, saves one
from digging into the cgroup code.