Skip to content

Commit

Permalink
[PATCH] fix creating zero sized bio mempools in low memory system
Browse files Browse the repository at this point in the history
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).

Signed-off-by: Milan Broz <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Milan Broz authored and Jens Axboe committed Sep 30, 2006
1 parent bcfd8d3 commit 50be345
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ static int biovec_create_pools(struct bio_set *bs, int pool_entries, int scale)
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);
Expand Down

0 comments on commit 50be345

Please sign in to comment.