From 9c3e13e3314da394698ca32f21cc46d46b7cfe47 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Sat, 7 Nov 2015 17:33:38 -0700 Subject: [PATCH] smalloc: only clear the bitmap, not the whole pool This reduces startup time, and the memset() isn't useful nor needed on the full range. Signed-off-by: Jens Axboe --- smalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smalloc.c b/smalloc.c index 8412e751..5047cda5 100644 --- a/smalloc.c +++ b/smalloc.c @@ -213,9 +213,9 @@ static int add_pool(struct pool *pool, unsigned int alloc_size) if (ptr == MAP_FAILED) goto out_fail; - memset(ptr, 0, alloc_size); pool->map = ptr; pool->bitmap = (void *) ptr + (pool->nr_blocks * SMALLOC_BPL); + memset(pool->bitmap, 0, bitmap_blocks * sizeof(unsigned int)); pool->lock = fio_mutex_init(FIO_MUTEX_UNLOCKED); if (!pool->lock) -- 2.25.1