]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: memory: don't let pool_put_to_cache() free the objects itself
authorWilly Tarreau <w@1wt.eu>
Mon, 1 Jun 2020 16:16:57 +0000 (18:16 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 11 Jun 2020 08:18:56 +0000 (10:18 +0200)
commitfb117e6a8eaa491c32896d90aeaaca5609a7317c
treeaa75c09a7614801fd620d09105fbcd0727720930
parenta6982e58687679753137498a6e8de2179a6f7993
MEDIUM: memory: don't let pool_put_to_cache() free the objects itself

Just as for the allocation path, the release path was not symmetrical.
It was not logical to have pool_put_to_cache() free the objects itself,
it was pool_free's job. In addition, just because of a variable export
issue, it the insertion of the object to free back into the local cache
couldn't be inlined while it was very cheap.

This patch just slightly reorganizes this code path by making pool_free()
decide whether or not to put the object back into the cache via
pool_put_to_cache() otherwise place it back to the global pool using
__pool_free().  Then pool_put_to_cache() adds the item to the local
cache and only calls pool_evict_from_cache() if the cache is too big.
include/common/memory.h
src/memory.c