Re: [PATCH 1/3] perf report: Fix OOM error in TUI mode on s390

Thomas-Mich Richter
2019-05-23T08:12:59Z

On 5/22/19 8:08 PM, Arnaldo Carvalho de Melo wrote:
> Em Wed, May 22, 2019 at 04:45:59PM +0200, Thomas Richter escreveu:
>

.....

>>
>> This size kills the TUI interface when executing the following
>> code:
>>
>> process_sample_event()
>> hist_entry_iter__add()
>> hist_iter__report_callback()
>> hist_entry__inc_addr_samples()
>> symbol__inc_addr_samples(symbol = __bss_stop)
>> symbol__cycles_hist()
>> annotated_source__alloc_histograms(...,
>> symbol__size(sym),
>> ...)
>>
>> This function allocates memory to save sample histograms.
>> The symbol_size() marco is defined as sym->end - sym->start, which
>> results in above value of 0x3fe6e64a850 bytes and
>> the call to calloc() in annotated_source__alloc_histograms() fails.
>
> Humm, why are we getting samples in that area? Is it some JITted thing
> like BPF? What is it?
>
> Why not just not consider the calloc failure as fatal, and when/if the
> user asks for annotation on such symbol, tell the user that it wasn't
> possible to allocate N bytes for it?
>
> - Arnaldo

I have not debugged why this sample address was recorded. BPF code was not
running.

I have no problem with making calloc() failure no fatal, however we might
still allocate large memory...

I will send a new patch.

--
Thomas Richter, Dept 3252, IBM s390 Linux Development, Boeblingen, Germany
--
Vorsitzender des Aufsichtsrats: Matthias Hartmann
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294