public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix creating zero sized bio mempools in low memory system
@ 2006-09-04 12:31 Milan Broz
  2006-09-04 12:43 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Milan Broz @ 2006-09-04 12:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Jens Axboe

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 <mbroz@redhat.com>

Index: linux-2.6.18-rc6/fs/bio.c
===================================================================
--- linux-2.6.18-rc6.orig/fs/bio.c
+++ 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);



-- 
VGER BF report: U 0.493705

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fix creating zero sized bio mempools in low memory system
  2006-09-04 12:31 [PATCH] fix creating zero sized bio mempools in low memory system Milan Broz
@ 2006-09-04 12:43 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2006-09-04 12:43 UTC (permalink / raw)
  To: Milan Broz; +Cc: linux-kernel, Andrew Morton

On Mon, Sep 04 2006, Milan Broz wrote:
> 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.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-04 12:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-04 12:31 [PATCH] fix creating zero sized bio mempools in low memory system Milan Broz
2006-09-04 12:43 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox