mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-21 13:16:57 +00:00
DEBUG: pools: always record the caller for uncached allocs as well
When recording the caller of a pool_alloc(), we currently store it only when the object comes from the cache and never when it comes from the heap. There's no valid reason for this except that the caller's pointer was not passed to pool_alloc_nocache(), so it used to set NULL there. Let's just pass it down the chain.
This commit is contained in:
parent
2dedbe76c9
commit
baf2070421
@ -106,7 +106,7 @@ void trim_all_pools(void);
|
||||
|
||||
void *pool_get_from_os_noinc(struct pool_head *pool);
|
||||
void pool_put_to_os_nodec(struct pool_head *pool, void *ptr);
|
||||
void *pool_alloc_nocache(struct pool_head *pool);
|
||||
void *pool_alloc_nocache(struct pool_head *pool, const void *caller);
|
||||
void pool_free_nocache(struct pool_head *pool, void *ptr);
|
||||
void dump_pools(void);
|
||||
int pool_parse_debugging(const char *str, char **err);
|
||||
|
@ -49,7 +49,7 @@ int init_buffer()
|
||||
pool_head_buffer->limit = global.tune.buf_limit;
|
||||
|
||||
for (done = 0; done < pool_head_buffer->minavail - 1; done++) {
|
||||
buffer = pool_alloc_nocache(pool_head_buffer);
|
||||
buffer = pool_alloc_nocache(pool_head_buffer, init_buffer);
|
||||
if (!buffer)
|
||||
return 0;
|
||||
pool_free(pool_head_buffer, buffer);
|
||||
|
@ -420,7 +420,7 @@ void pool_put_to_os_nodec(struct pool_head *pool, void *ptr)
|
||||
* and directly returns it. The pool's counters are updated but the object is
|
||||
* never cached, so this is usable with and without local or shared caches.
|
||||
*/
|
||||
void *pool_alloc_nocache(struct pool_head *pool)
|
||||
void *pool_alloc_nocache(struct pool_head *pool, const void *caller)
|
||||
{
|
||||
void *ptr = NULL;
|
||||
uint bucket;
|
||||
@ -436,7 +436,7 @@ void *pool_alloc_nocache(struct pool_head *pool)
|
||||
|
||||
/* keep track of where the element was allocated from */
|
||||
POOL_DEBUG_SET_MARK(pool, ptr);
|
||||
POOL_DEBUG_TRACE_CALLER(pool, (struct pool_cache_item *)ptr, NULL);
|
||||
POOL_DEBUG_TRACE_CALLER(pool, (struct pool_cache_item *)ptr, caller);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@ -839,7 +839,7 @@ void *__pool_alloc(struct pool_head *pool, unsigned int flags)
|
||||
p = pool_get_from_cache(pool, caller);
|
||||
|
||||
if (unlikely(!p))
|
||||
p = pool_alloc_nocache(pool);
|
||||
p = pool_alloc_nocache(pool, caller);
|
||||
|
||||
if (likely(p)) {
|
||||
#ifdef USE_MEMORY_PROFILING
|
||||
|
Loading…
Reference in New Issue
Block a user