All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH 0/3] tun: fix aio
Date: Tue, 5 May 2009 11:40:05 +0300	[thread overview]
Message-ID: <20090505084005.GA14527@redhat.com> (raw)
In-Reply-To: <200905051248.14014.rusty@rustcorp.com.au>

On Tue, May 05, 2009 at 12:48:13PM +0930, Rusty Russell wrote:
> On Mon, 27 Apr 2009 07:04:55 pm Michael S. Tsirkin wrote:
> > On Mon, Apr 27, 2009 at 10:48:37AM +0930, Rusty Russell wrote:
> > > > Sure. Here it is: much smaller, but slightly slower.
> > > 
> > > Which could probably be fixed by using an on-stack version for a iovec
> > > of less than a certain size...
> > 
> > I agree that for large message sizes the malloc would probably be
> > dwarfed by the cost of memory copy. However a large iovec might pass a
> > small message, might it not?
> 
> Sorry, I didn't make myself clear.  Something like:
> 
> 	struct iovec smalliov[512 / sizeof(struct iovec)];
> 
> 	if (count < ARRAY_SIZE(smalliov)) {
> 		iv = smalliov;
> 	} else {
> 		iv = kmalloc(...)
> 	}
> 
> 	...
> 
> 	if (iv != smalliov)
> 		kfree(iv);
> 
> Cheers,
> Rusty.

What I was trying to say is that this special-cases iovecs with count >
64. But I think that such iovecs might be used to still pass around
relatively small messages (theoretically as small as 64 bytes) and then
the overhead of the kmalloc/kfree is noticeable.

-- 
MST

  reply	other threads:[~2009-05-05  8:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-20 11:25 [PATCH 0/3] tun: fix aio Michael S. Tsirkin
2009-04-20 12:09 ` Herbert Xu
2009-04-20 12:21   ` Michael S. Tsirkin
2009-04-27  1:18     ` Rusty Russell
2009-04-27  9:34       ` Michael S. Tsirkin
2009-05-05  3:18         ` Rusty Russell
2009-05-05  8:40           ` Michael S. Tsirkin [this message]
2009-04-21 12:50 ` Michael S. Tsirkin
2009-04-21 13:02   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090505084005.GA14527@redhat.com \
    --to=mst@redhat.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.