Re: [PATCH 5/7] perf: cache perf_event_groups_first for cgroups

From: Peter Zijlstra
Date: Mon Jul 08 2019 - 12:50:42 EST


On Mon, Jul 01, 2019 at 11:59:53PM -0700, Ian Rogers wrote:
> @@ -3511,7 +3550,12 @@ static int visit_groups_merge(struct perf_event_context *ctx,
> min_heapify_all(&heap);
>
> while (heap.num_elements > 0) {
> - ret = func(ctx, cpuctx, heap.storage[0], data);
> + if (is_pinned)
> + ret = pinned_sched_in(ctx, cpuctx, heap.storage[0]);
> + else
> + ret = flexible_sched_in(ctx, cpuctx, heap.storage[0],
> + data);
> +
> if (ret)
> return ret;
>

You can actually merge those two functions; see merge_sched_in() in the
below patch:

https://lkml.kernel.org/r/20181010104559.GO5728@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx