From 923a909db87d6f62a8031fc815725034c2403bdd Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Wed, 9 Oct 2019 09:06:52 -0400 Subject: [PATCH] tests/mem_pool_threadsafe: use actual minimum mempool block size On 64-bit targets, the minimum possible mempool block size is not 8 but 16. With a max block size of 32, the mempool allocator cannot split it into 4 sub-blocks, reducing the available memory allocations to that original 32-byte block only. To get the same allocation patterns and test behavior whether it is built for a 32-bit or 64-bit architecture, let's define BLK_SIZE_MIN and BLK_SIZE_MAX in terms of _MPOOL_MINBLK instead of literal values. Signed-off-by: Nicolas Pitre --- tests/kernel/mem_pool/mem_pool_threadsafe/src/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/kernel/mem_pool/mem_pool_threadsafe/src/main.c b/tests/kernel/mem_pool/mem_pool_threadsafe/src/main.c index c85f6b0658a..6f701232196 100644 --- a/tests/kernel/mem_pool/mem_pool_threadsafe/src/main.c +++ b/tests/kernel/mem_pool/mem_pool_threadsafe/src/main.c @@ -11,11 +11,11 @@ #define POOL_NUM 2 #define LOOPS 10 #define TIMEOUT 200 -#define BLK_SIZE_MIN 8 -#define BLK_SIZE_MAX 32 +#define BLK_SIZE_MIN _MPOOL_MINBLK +#define BLK_SIZE_MAX (4 * BLK_SIZE_MIN) #define BLK_NUM_MIN 8 #define BLK_NUM_MAX 2 -#define BLK_ALIGN BLK_SIZE_MIN +#define BLK_ALIGN sizeof(void *) K_MEM_POOL_DEFINE(mpool1, BLK_SIZE_MIN, BLK_SIZE_MAX, BLK_NUM_MAX, BLK_ALIGN); K_MEM_POOL_DEFINE(mpool2, BLK_SIZE_MIN, BLK_SIZE_MAX, BLK_NUM_MAX, BLK_ALIGN);