lkml.org 
[lkml]   [2018]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC][PATCH] perf: Rewrite core context handling
Date


> On Oct 16, 2018, at 2:50 AM, Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Sat, Oct 13, 2018 at 08:31:37AM +0000, Song Liu wrote:
>
>> The only suggestion I have right now is on which struct owns which
>> data:
>>
>> 1. perf_cpu_context owns two perf_event_context: ctx and *task_ctx.
>> This is the same as right now.
>
>> 2. perf_event_context owns multiple perf_event_pmu_context:
>> One perf_event_pmu_context for software groups;
>> One perf_event_pmu_context for each hardware PMU.
>
> It does now already, right? Through the pmu_ctx_list we can, given an
> perf_event_context, find all associated perf_event_pmu_context's.

Yes, this is very similar to right now. It is related to #4, #5 below.
With current patch, perf_cpu_pmu_context is more like the "owner" of
the per CPU perf_event_pmu_context. I feel it is more natural that
perf_cpu_context is the owner of perf_event_pmu_context, while the
perf_cpu_pmu_context doesn't own anything.

Again, the difference to current patch is very small.

>
>> 3. perf_event_pmu_context owns RB tree of events. Since we don't
>> need rotation across multiple hardware PMUs, the rotation is
>> within same perf_event_pmu_context.
>
> By keeping the RB trees in perf_event_context, we get bigger trees,
> which is more efficient (log(n+m) < log(n) + log(m))
>
> Also, specifically, it means we only need a single merge sort /
> iteration to schedule in a full context, instead of (again) doing 'n' of
> them.
>
> Also, given a context and a pmu, it is cheaper for finding the relevant
> events; this is needed for big.little for instance. Something the
> proposed patch doesn't fully flesh out.

Would it be faster if we add a perf_event_pmu_context pointer to the
perf_event? I think a group on hw PMU-a should never know a group on
hw PMU-b. So some separation would make things simpler.

Thanks,
Song

\
 
 \ /
  Last update: 2018-10-16 18:35    [W:0.018 / U:15.424 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site