[Skiboot] [PATCH v2] mem_region: Merge similar allocations when dumping

Stewart Smith stewart at linux.ibm.com
Thu Aug 2 16:48:14 AEST 2018

"Oliver O'Halloran" <oohall at gmail.com> writes:
> Currently we print one line for each allocation done at runtime when
> dumping the memory allocations. We do a few thousand allocations at
> boot so this can result in a huge amount of text being printed which
> is a) slow to print, and b) Can result in the log buffer overflowing
> which destroys otherwise useful information.
> This patch adds a de-duplication to this memory allocation dump by
> merging "similar" allocations (same location, same size) into one.
> Unfortunately, the algorithm used to do the de-duplication is quadratic,
> but considering we only dump the allocations in the event of a fatal
> error I think this is acceptable. I also did some benchmarking and found
> that on a ZZ it takes ~3ms to do a dump with 12k allocations. On a Zaius
> it's slightly longer at about ~10ms for 10k allocs. However, the
> difference there was due to the output being written to the UART.
> This patch also bumps the log level to PR_NOTICE. PR_INFO messages are
> suppressed at the default log level, which probably isn't something you
> want considering we only dump the allocations when we run out of skiboot
> heap space.
> Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
> ---
> v2: Only perform the dump on the first allocation failure rather
>     than every time. This allows us to extract useful debug information
>     when there is an allocation failure without spamming the console
>     too much.
>     Fixed some 80 cols junk.
> ---
>  core/mem_region.c | 49 ++++++++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 42 insertions(+), 7 deletions(-)

cheers. Merged to master as of 55cab51c74a8a6c5bb2e298e541ab125c5ade553.

Now I just need to run out of memory somewhere at some point so I can
enjoy the great glory of slightly better terribleness.

Stewart Smith
OPAL Architect, IBM.

More information about the Skiboot mailing list