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: Rob Landley <rlandley@parallels.com>,
	virtualization@lists.linux-foundation.org
Subject: Re: [RFC PATCH TRIVIAL] Reading the virtio code...
Date: Wed, 27 Apr 2011 09:26:48 +0300	[thread overview]
Message-ID: <20110427062648.GA15788@redhat.com> (raw)
In-Reply-To: <87aafcl0so.fsf@rustcorp.com.au>

On Wed, Apr 27, 2011 at 02:59:27PM +0930, Rusty Russell wrote:
> On Sat, 23 Apr 2011 18:13:34 -0500, Rob Landley <rlandley@parallels.com> wrote:
> > From: Rob Landley <rlandley@parallels.com>
> > 
> > Going indirect for only two buffers isn't likely to be a performance win
> > because the kmalloc/kfree overhead for the indirect block can't be cheaper
> > than one extra linked list traversal.
> 
> Unfortunately it's not completely clear.  QEMU sets fairly small rings,
> and the virtio-net driver uses 2 descriptors minimum.  The effect can be
> a real bottleneck for small packets.
> 
> Now, virtio-net could often stuff the virtio_net_hdr in the space before
> the packet data (saving a descriptor) but I think that will need a
> feature bit since qemu (incorrectly) used to insist on a separate
> descriptor for that header.
> 
> > Properly "tuning" the threshold would probably be workload-specific.
> > (One big downside of not going indirect is extra pressure on the table
> > entries, and table size varies.)  But I think that in the general case,
> > 2 is a defensible minimum?
> 
> I'd be tempted to say that once we fill the ring, we should drop the
> threshold.
> 
> Michael?
> 
> Thanks,
> Rusty.

Yes, one idea is to use part of a ring (e.g. 1/4 of a ring) for direct
entries, and the rest for indirect. So we end up with a threshold like

	max(1, vq->num_free - in - out - vq->num * N)

(above is pseudo-code, must take care of unsigned vs signed etc)
and I think I'd try with N = 3/4 or maybe N = 1/2


-- 
MST

      reply	other threads:[~2011-04-27  6:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-23 23:13 [RFC PATCH TRIVIAL] Reading the virtio code Rob Landley
2011-04-27  5:29 ` Rusty Russell
2011-04-27  6:26   ` Michael S. Tsirkin [this message]

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=20110427062648.GA15788@redhat.com \
    --to=mst@redhat.com \
    --cc=rlandley@parallels.com \
    --cc=rusty@rustcorp.com.au \
    --cc=virtualization@lists.linux-foundation.org \
    /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.