public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio-blk: allow more than one in-flight request
@ 2008-03-27 16:29 Marcelo Tosatti
  2008-03-27 17:45 ` Christian Borntraeger
  2008-03-27 23:22 ` Rusty Russell
  0 siblings, 2 replies; 4+ messages in thread
From: Marcelo Tosatti @ 2008-03-27 16:29 UTC (permalink / raw)
  To: Rusty Russell, Anthony Liguori; +Cc: kvm-devel


Allow more than one in-flight request in the virtio ring. This allows
the host driver to submit requests in parallel.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>


diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 3b1a68d..5bb041f 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -30,6 +30,8 @@ struct virtio_blk
 	struct scatterlist sg[VIRTIO_MAX_SG];
 };
 
+#define VIRTIO_BLK_POOL_SIZE 32
+
 struct virtblk_req
 {
 	struct list_head list;
@@ -202,7 +204,8 @@ static int virtblk_probe(struct virtio_device *vdev)
 		goto out_free_vblk;
 	}
 
-	vblk->pool = mempool_create_kmalloc_pool(1,sizeof(struct virtblk_req));
+	vblk->pool = mempool_create_kmalloc_pool(VIRTIO_BLK_POOL_SIZE,
+                        sizeof(struct virtblk_req));
 	if (!vblk->pool) {
 		err = -ENOMEM;
 		goto out_free_vq;

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

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

* Re: [PATCH] virtio-blk: allow more than one in-flight request
  2008-03-27 16:29 [PATCH] virtio-blk: allow more than one in-flight request Marcelo Tosatti
@ 2008-03-27 17:45 ` Christian Borntraeger
  2008-03-27 20:30   ` Marcelo Tosatti
  2008-03-27 23:22 ` Rusty Russell
  1 sibling, 1 reply; 4+ messages in thread
From: Christian Borntraeger @ 2008-03-27 17:45 UTC (permalink / raw)
  To: kvm-devel; +Cc: Marcelo Tosatti

Am Donnerstag, 27. März 2008 schrieb Marcelo Tosatti:
> 
> Allow more than one in-flight request in the virtio ring. This allows
> the host driver to submit requests in parallel.
[...]
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 3b1a68d..5bb041f 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
[...]
> @@ -202,7 +204,8 @@ static int virtblk_probe(struct virtio_device *vdev)
>  		goto out_free_vblk;
>  	}
> 
> -	vblk->pool = mempool_create_kmalloc_pool(1,sizeof(struct virtblk_req));
> +	vblk->pool = mempool_create_kmalloc_pool(VIRTIO_BLK_POOL_SIZE,
> +                        sizeof(struct virtblk_req));
>  	if (!vblk->pool) {
>  		err = -ENOMEM;
>  		goto out_free_vq;
[...]

Huh? I dont understand. You only change the number of pre-allocated pool 
entries. mempool_alloc should allow several allocations, even with 1 as 
initialization value. The pre-initialized value is only for oom situations. 
No?

Christian

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

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

* Re: [PATCH] virtio-blk: allow more than one in-flight request
  2008-03-27 17:45 ` Christian Borntraeger
@ 2008-03-27 20:30   ` Marcelo Tosatti
  0 siblings, 0 replies; 4+ messages in thread
From: Marcelo Tosatti @ 2008-03-27 20:30 UTC (permalink / raw)
  To: Christian Borntraeger; +Cc: kvm-devel, Marcelo Tosatti

On Thu, Mar 27, 2008 at 06:45:14PM +0100, Christian Borntraeger wrote:
> Am Donnerstag, 27. März 2008 schrieb Marcelo Tosatti:
> > 
> > Allow more than one in-flight request in the virtio ring. This allows
> > the host driver to submit requests in parallel.
> [...]
> > diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> > index 3b1a68d..5bb041f 100644
> > --- a/drivers/block/virtio_blk.c
> > +++ b/drivers/block/virtio_blk.c
> [...]
> > @@ -202,7 +204,8 @@ static int virtblk_probe(struct virtio_device *vdev)
> >  		goto out_free_vblk;
> >  	}
> > 
> > -	vblk->pool = mempool_create_kmalloc_pool(1,sizeof(struct virtblk_req));
> > +	vblk->pool = mempool_create_kmalloc_pool(VIRTIO_BLK_POOL_SIZE,
> > +                        sizeof(struct virtblk_req));
> >  	if (!vblk->pool) {
> >  		err = -ENOMEM;
> >  		goto out_free_vq;
> [...]
> 
> Huh? I dont understand. You only change the number of pre-allocated pool 
> entries. mempool_alloc should allow several allocations, even with 1 as 
> initialization value. The pre-initialized value is only for oom situations. 
> No?

Thats right, the mempool allocation will fail under memory pressure
(since __GFP_NOMEMALLOC is passed from mempool_allocate), but under
normal circumstances it will allocate more than one entry.

So ignore the patch. Sorry for the noise.



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

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

* Re: [PATCH] virtio-blk: allow more than one in-flight request
  2008-03-27 16:29 [PATCH] virtio-blk: allow more than one in-flight request Marcelo Tosatti
  2008-03-27 17:45 ` Christian Borntraeger
@ 2008-03-27 23:22 ` Rusty Russell
  1 sibling, 0 replies; 4+ messages in thread
From: Rusty Russell @ 2008-03-27 23:22 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm-devel

On Friday 28 March 2008 03:29:48 Marcelo Tosatti wrote:
> Allow more than one in-flight request in the virtio ring. This allows
> the host driver to submit requests in parallel.
>
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

For a moment, I thought this was true and felt very stupid :)

For the record, the mempool_alloc becomes kmalloc with fallback to the pool.  
We only need one because we can make progress with one request at a time if 
we have to.

Cheers,
Rusty.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

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

end of thread, other threads:[~2008-03-27 23:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-27 16:29 [PATCH] virtio-blk: allow more than one in-flight request Marcelo Tosatti
2008-03-27 17:45 ` Christian Borntraeger
2008-03-27 20:30   ` Marcelo Tosatti
2008-03-27 23:22 ` Rusty Russell

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