tests/kernel/mem_slab: Fix memory overcommit

This test spawned 4 threads all of which try to allocate 3 blocks from
the same mem_slab before freeing any, leading to a maximum of 12
in-flight allocations.  But the slab contained only 3 blocks!

Most of the time it passed, but CI caught it failing on occasion,
possibly more often now due to recent scheduler changes.  Fixes #8069
(hopefully).

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2018-05-31 10:13:53 -07:00 committed by Anas Nashif
parent c84b37b086
commit 4ef36a4b54

View File

@ -16,7 +16,7 @@
#define BLK_SIZE1 8
#define BLK_SIZE2 4
K_MEM_SLAB_DEFINE(mslab1, BLK_SIZE1, BLK_NUM, BLK_ALIGN);
K_MEM_SLAB_DEFINE(mslab1, BLK_SIZE1, BLK_NUM * THREAD_NUM, BLK_ALIGN);
static struct k_mem_slab mslab2, *slabs[SLAB_NUM] = { &mslab1, &mslab2 };
static K_THREAD_STACK_ARRAY_DEFINE(tstack, THREAD_NUM, STACK_SIZE);
static struct k_thread tdata[THREAD_NUM];