Re: [PATCH v5 1/4]: perf/core: use rb trees for pinned/flexible groups

From: Alexander Shishkin
Date: Tue Jul 18 2017 - 08:29:20 EST


Alexey Budankov <alexey.budankov@xxxxxxxxxxxxxxx> writes:

> +/*
> + * Helper function to test if event groups are empty;
> + */
> +static int
> +perf_event_groups_empty(struct perf_event_groups *groups)
> +{
> + return list_empty(&groups->list);
> +}

This doesn't seem useful, it's only used once. Also, it's not clear how
access to groups->list is serialized here, but it is in the caller.

I'm assuming you will use this helper after the linked lists are done
away with, but I'll have to go fishing for that patch to make sure.

> +static void
> +perf_event_groups_insert(struct perf_event_groups *groups,
> + struct perf_event *event)
> +{
> + struct rb_node **node;
> + struct rb_node *parent;
> + struct perf_event *node_event;
> +
> + WARN_ON_ONCE(!groups || !event);

I'm pretty sure neither of these is plausible.

> + WARN_ON_ONCE(!list_empty(&event->group_list_entry));

So ctx::lock is held here, right? That could be a useful assert and/or
comment at least for review purposes. Now I see that it's called from
list_add_event().

Regards,
--
Alex