Skip to content

Commit 77b1c2c

Browse files
committed
common: tlsf_malloc: fix tlsf request memory store to get a little more than what we need.
1 parent 23779ec commit 77b1c2c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

common/tlsf_malloc.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <stdio.h>
1212
#include <module.h>
1313
#include <tlsf.h>
14+
#include <linux/sizes.h>
15+
#include <linux/log2.h>
1416

1517
#include <linux/kasan.h>
1618
#include <linux/list.h>
@@ -128,7 +130,11 @@ void *malloc_add_pool(void *mem, size_t bytes)
128130

129131
static void tlsf_request_store(tlsf_t tlsf, size_t bytes)
130132
{
131-
malloc_request_store(bytes);
133+
size_t size;
134+
135+
size = __roundup_pow_of_two(bytes + tlsf_pool_overhead());
136+
137+
malloc_request_store(max((size_t)SZ_8M, size));
132138
}
133139

134140
void malloc_register_store(void (*cb)(size_t bytes))

0 commit comments

Comments
 (0)