Re: [PATCH 3/4] perf record: event synthesization multithreading support

From: Ingo Molnar
Date: Fri Oct 13 2017 - 16:07:09 EST



* Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:

> Em Fri, Oct 13, 2017 at 07:09:26AM -0700, kan.liang@xxxxxxxxx escreveu:
> > From: Kan Liang <Kan.liang@xxxxxxxxx>
> >
> > The process function process_synthesized_event writes the process
> > result to perf.data, which is not multithreading friendly.
> >
> > Realloc buffer for each thread to temporarily keep the processing
> > result. Write them to the perf.data at the end of event synthesization.
> > The new method doesn't impact the final result, because
> > - The order of the synthesized event is not important.
> > - The number of synthesized event is limited. Usually, it only needs
> > hundreds of Kilobyte to store all the synthesized event.
> > It's unlikly failed because of lack of memory.
>
> Why not write to a per cpu file and then at the end merge them? Leave
> the memory management to the kernel, i.e. in most cases you may even not
> end up touching the disk, when memory is plentiful, just rewind the per
> event files and go on dumping to the main perf.data file.
>
> At some point we may just don't do this merging, and keep per cpu files
> all the way to perf report, etc. This would be a first foray into
> that...

Yeah, that sounds like a really good zero-copy recording scheme, and I bet it
would scale like a crazed bat out of hell!

Thanks,

Ingo