]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: memory: don't let __pool_get_first() pick from the cache
authorWilly Tarreau <w@1wt.eu>
Mon, 1 Jun 2020 15:51:05 +0000 (17:51 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 11 Jun 2020 08:18:56 +0000 (10:18 +0200)
commita6982e58687679753137498a6e8de2179a6f7993
tree149dca9fc5117c0835338d40e32982f42f0a078f
parent24aa1eebaa295b14d75583c9a66ac96aa7151eae
MINOR: memory: don't let __pool_get_first() pick from the cache

When building with the local cache support, we have an asymmetry in
the allocation path which is that __pool_get_first() picks from the
cache while when no cache support is used, this one directly accesses
the shared area. It looks like it was done this way only to centralize
the call to __pool_get_from_cache() but this was not a good idea as it
complicates the splitting the code.

Let's move the cache access to the upper layer so thatt __pool_get_first()
remains agnostic to the cache support.

The call tree now looks like this with the cache enabled :

    pool_get_first()
      __pool_get_from_cache() // if cache enabled
      __pool_get_first()

    pool_alloc()
      pool_alloc_dirty()
        __pool_get_from_cache() // if cache enabled
        __pool_get_first()
        __pool_refill_alloc()

    __pool_free()
      pool_free_area()

    pool_put_to_cache()
      __pool_free()
      __pool_put_to_cache()

    pool_free()
      pool_put_to_cache()

With cache disabled, the pool_free() path still differs:

    pool_free()
      __pool_free_area()
      __pool_put_to_cache()
include/common/memory.h