[Skiboot] Memory allocations / free HEAP space

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Tue Apr 7 22:39:00 AEST 2015

On 04/07/2015 03:29 AM, Stewart Smith wrote:
> Hi all,
> I've been looking at HEAP usage of skiboot booting in various
> environments.
> We currently reserve 12MB for heap (or 11MB once there's my gcov
> modifications). On Mambo, we only use about 600k -
> but this is due to there being only one cpu and pretty much no
> devices. On a dual socket P8, we use a lot more - on an FSP system we
> currently only have 2.3MB free when we boot the kernel. This is possibly
> getting a bit close.
> We can take one (or both) of these actions:
> 1) reduce memory usage
> 2) add extra heap.
> I added a small patch to dump out the allocations and free space,
> getting a decent view as to both memory usage and free space
> fragmentation.
> The big allocations are:
> [15649665335,5]     0x00100010 hw/fsp/fsp-console.c:543.
> We preallocate memory for each possible console. We possibly don't need
> to allocate all of these on startup, perhaps only when console is opened?
> [15649677058,5]     0x0000c010 hw/fsp/fsp-mem-err.c:386.
> This should probably be converted to use core/pool.c rather than custom
> pool.
> [15649684021,5]     0x00040010 hw/fsp/fsp-elog-read.c:537.

I think we just use 16K here. I will take a look.

> [15649691303,5]     0x00001010 hw/fsp/fsp-elog-read.c:515.
> Instinctively I think this should be core/pool.c rather than custom one,
> but I haven't looked into details.

Probably yes. Pool code came after these.. So we see many places we we have
custom code.

> We also probably don't need to statically allocate the error log buffer
> to read from FSP?

Given the amount of error log we get I think its better to keep it static.

> [15649698639,5]     0x00010010 hw/fsp/fsp-elog-write.c:398.
> We do probably want to keep the panic buffer allocated at boot time,
> although in the code path that uses it, we probably also want to avoid
> allocations (which it doesn't look like we really succeed at).
> [15649706019,5]     0x00040010 hw/fsp/fsp-elog-write.c:405.
> [15649713362,5]     0x00010010 hw/fsp/fsp-elog-write.c:412.

Same here. We just need 3 X 16K. I will take a look.

> probably also should be core/pool.c
> [15649720676,5]     0x000e1010 core/pool.c:66.
> This is actually from somewhere else, not sure where though.

Well this comes from elog write code .


More information about the Skiboot mailing list