[PATCH 06/25] Add struct scratch_buffer and its internal helper functions

Florian Weimer fweimer@redhat.com
Wed Apr 8 20:03:00 GMT 2015


On 04/03/2015 06:25 PM, Ondřej Bílka wrote:

>> The original code used a growth factor of 3 during the alloca phase, and
>> 2 during the malloc phase.  (After the i386 ABI change for stack
>> alignment, it's effectively 2 and 2.)

> That does not make much sense. Its mostly used in funcions that cannot
> realloc array themself so we double space until it fits. As its
> temporary its better to overallocate than try save space.

I suppose that could be true.  There are two exceptions: When we cross
the trim threshold, and when we cross the mmap threshold.  Both could be
quite bad performance-wise.  I think we could come up with a sizing
strategy that avoids that—or change NSS to allocate the buffer at the
point where the size is known (my preference).

However, it's true that it was more important to conserve space when the
code used alloca.

Thanks for your review of five of the other patches; I committed them
with suitable ChangeLog entries.

-- 
Florian Weimer / Red Hat Product Security



More information about the Libc-alpha mailing list