mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-15 21:59:41 -04:00
MINOR: pools: call malloc_trim() under thread isolation
pool_gc() was adjusted to run under thread isolation by commitc0e2ff202("MEDIUM: memory: make pool_gc() run under thread isolation") so that the underlying malloc() and free() don't compete between threads during these potentially aggressive moments (especially when mmap/munmap are involved). Commit88366c292("MEDIUM: pools: call malloc_trim() from pool_gc()") later added a call to malloc_trim() but made it outside of the thread isolation, which is contrary to the principle explained above. Also it missed it in the locked version, meaning that those without a lockless implementation cannot benefit from trimming. This patch fixes that by calling it before thread_release() in both places.
This commit is contained in:
parent
c88914379d
commit
26ed183556
1 changed files with 6 additions and 3 deletions
|
|
@ -345,12 +345,11 @@ void pool_gc(struct pool_head *pool_ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isolated)
|
|
||||||
thread_release();
|
|
||||||
|
|
||||||
#if defined(HA_HAVE_MALLOC_TRIM)
|
#if defined(HA_HAVE_MALLOC_TRIM)
|
||||||
malloc_trim(0);
|
malloc_trim(0);
|
||||||
#endif
|
#endif
|
||||||
|
if (!isolated)
|
||||||
|
thread_release();
|
||||||
}
|
}
|
||||||
|
|
||||||
#else /* CONFIG_HAP_LOCKLESS_POOLS */
|
#else /* CONFIG_HAP_LOCKLESS_POOLS */
|
||||||
|
|
@ -402,6 +401,10 @@ void pool_gc(struct pool_head *pool_ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(HA_HAVE_MALLOC_TRIM)
|
||||||
|
malloc_trim(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!isolated)
|
if (!isolated)
|
||||||
thread_release();
|
thread_release();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue