smalloc: only clear the bitmap, not the whole pool
authorJens Axboe <axboe@fb.com>
Sun, 8 Nov 2015 00:33:38 +0000 (17:33 -0700)
committerJens Axboe <axboe@fb.com>
Sun, 8 Nov 2015 00:33:38 +0000 (17:33 -0700)
This reduces startup time, and the memset() isn't useful nor
needed on the full range.

Signed-off-by: Jens Axboe <axboe@fb.com>
smalloc.c

index 8412e7518464d6dbe3e7f218e33e47e855e8e26f..5047cda5e3438c8215a3bb549577f5a81e5b0a29 100644 (file)
--- 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;
 
        if (ptr == MAP_FAILED)
                goto out_fail;
 
-       memset(ptr, 0, alloc_size);
        pool->map = ptr;
        pool->bitmap = (void *) ptr + (pool->nr_blocks * SMALLOC_BPL);
        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)
 
        pool->lock = fio_mutex_init(FIO_MUTEX_UNLOCKED);
        if (!pool->lock)