From: Jens Axboe Date: Sun, 8 Nov 2015 00:33:38 +0000 (-0700) Subject: smalloc: only clear the bitmap, not the whole pool X-Git-Tag: fio-2.2.12~23 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=9c3e13e3314da394698ca32f21cc46d46b7cfe47;ds=sidebyside 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 --- 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)