]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: memory: improve pool_refill_alloc() to pass a refill count
authorWilly Tarreau <w@1wt.eu>
Wed, 3 Dec 2014 14:25:28 +0000 (15:25 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 24 Dec 2014 22:47:31 +0000 (23:47 +0100)
commita885f6dc6519651301500edc461c75ccb533dc39
tree8782811a52a8297c50f7ef591989aa9a35228355
parent0262241e265fc615047e9156c65f805814357280
MEDIUM: memory: improve pool_refill_alloc() to pass a refill count

Till now this function would only allocate one entry at a time. But with
dynamic buffers we'll like to allocate the number of missing entries to
properly refill the pool.

Let's modify it to take a minimum amount of available entries. This means
that when we know we need at least a number of available entries, we can
ask to allocate all of them at once. It also ensures that we don't move
the pointers back and forth between the caller and the pool, and that we
don't call pool_gc2() for each failed malloc. Instead, it's called only
once and the malloc is only allowed to fail once.
include/common/memory.h
src/memory.c