[systemd-devel] [PATCH] Dynamically allocate bootchart logs

Lennart Poettering lennart at poettering.net
Fri May 3 09:14:08 PDT 2013


On Thu, 25.04.13 22:47, Kok, Auke-jan H (auke-jan.h.kok at intel.com) wrote:

> On Wed, Apr 24, 2013 at 5:20 PM, Zbigniew Jędrzejewski-Szmek
> <zbyszek at in.waw.pl> wrote:
> > On Wed, Apr 24, 2013 at 04:26:12PM -0700, Nathaniel Chen wrote:
> >> Instead of storing bootchart sample data in arrays, this patch moves
> >> storage to linked lists so that there is no more limit on samples.
> >
> > How does this approach compare to greedy_realloc?
> 
> One of the problems with the static arrays is that it was inherently
> allocating way too much memory to begin with. Most tasks live much
> less time than (samples * interval), the rest of the array space is
> just wasted.
> 
> The linked list approach drives down this memory requirement and makes
> navigating all the data much more straightforward. I also much prefer
> head pointers instead of having index numbers around.

Still sounds like greedy_realloc() is what you want here. Storing sample
data in a dynamically increasing array sounds much more natural than a
linked list.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list