mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-11 22:15:14 +00:00
BUG/MEDIUM: pools: fix the minimum allocation size
Fred reported a random crash related to the pools. This was introduced
by commit e18db9e98
("MEDIUM: pools: implement a thread-local cache for
pool entries") because the minimum pool item size should have been
increased to 32 bytes to accommodate the 2 double-linked lists.
No backport is needed.
This commit is contained in:
parent
68ad3a42f7
commit
30f931ead2
@ -62,10 +62,12 @@ struct pool_head *create_pool(char *name, unsigned int size, unsigned int flags)
|
|||||||
* ease merging of entries. Note that the rounding is a power of two.
|
* ease merging of entries. Note that the rounding is a power of two.
|
||||||
* This extra (void *) is not accounted for in the size computation
|
* This extra (void *) is not accounted for in the size computation
|
||||||
* so that the visible parts outside are not affected.
|
* so that the visible parts outside are not affected.
|
||||||
|
*
|
||||||
|
* Note: for the LRU cache, we need to store 2 doubly-linked lists.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!(flags & MEM_F_EXACT)) {
|
if (!(flags & MEM_F_EXACT)) {
|
||||||
align = 16;
|
align = 4 * sizeof(void *); // 2 lists = 4 pointers min
|
||||||
size = ((size + POOL_EXTRA + align - 1) & -align) - POOL_EXTRA;
|
size = ((size + POOL_EXTRA + align - 1) & -align) - POOL_EXTRA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user