Skip to contentSkip to conversation

fix creating zero sized bio mempools in low memory system

PATCH In review Milan Broz 2 participants 2 messages Sep 4, 2006 VFS

lore
Share & tools
lore

Milan Broz

author
#0 lore raw

PATCH 1/1 fix creating zero sized bio mempools in low memory system

In the very low memory systems is in the init_bio call scale parameter set to zero and it leads to creating zero sized mempool.

This patch prevents pool_entries parameter become zero, so the created pool have at least 1 entry.

Mempool with 0 entries lead to incorrect behaviour of mempool_free. (Alloc requests are not waken up and system stalls in mempool_alloc->ioschedule).

fs/bio.c +0 -0
Index: linux-2.6.18-rc6/fs/bio.c
===================================================================
@@ -1142,7 +1142,7 @@ static int biovec_create_pools(struct bi
		struct biovec_slab *bp = bvec_slabs + i;
		mempool_t **bvp = bs->bvec_pools + i;

- if (i >= scale)
+ if (pool_entries > 1 && i >= scale)

			pool_entries >>= 1;

		*bvp = mempool_create_slab_pool(pool_entries, bp->slab);
Signature · 1 line
VGER BF report: U 0.493705
#1 lore raw
Quoted 10 lines · Milan Broz

In the very low memory systems is in the init_bio call scale parameter set to zero and it leads to creating zero sized mempool.

This patch prevents pool_entries parameter become zero, so the created pool have at least 1 entry.

Mempool with 0 entries lead to incorrect behaviour of mempool_free. (Alloc requests are not waken up and system stalls in mempool_alloc->ioschedule).

Good catch, queued. Maybe this is the only such scaling problem, otherwise it may be a good idea to add a WARN_ON(!min_nr) to the mempool setup in mm/mempool.c to catch such errors.

Signature · 1 line
Jens Axboe