netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Benjamin Serebrin <serebrin@google.com>
Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Network Development <netdev@vger.kernel.org>,
	Jason Wang <jasowang@redhat.com>,
	David Miller <davem@davemloft.net>,
	Willem de Bruijn <willemb@google.com>,
	Venkatesh Srinivas <venkateshs@google.com>,
	"Jon Olson (Google Drive)" <jonolson@google.com>,
	Rick Jones <rick.jones2@hpe.com>,
	James Mattson <jmattson@google.com>,
	linux-s390 <linux-s390@vger.kernel.org>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>
Subject: Re: [PATCH v2 net-next] virtio: Fix affinity for #VCPUs != #queue pairs
Date: Wed, 15 Feb 2017 23:49:32 +0200	[thread overview]
Message-ID: <20170215234333-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAN+hb0X4UWmDvA0=5gpC6+Qt7vDgz0u5B79CM4KqQ-yuJmAO7Q@mail.gmail.com>

On Wed, Feb 15, 2017 at 01:38:48PM -0800, Benjamin Serebrin wrote:
> On Wed, Feb 15, 2017 at 11:17 AM, Michael S. Tsirkin <mst@redhat.com> wrote:
> 
> > Right. But userspace knows it's random at least. If kernel supplies
> > affinity e.g. the way your patch does, userspace ATM accepts this as a
> > gospel.
> 
> The existing code supplies the same affinity gospels in the #vcpu ==
> #queue case today.
> And the patch (unless it has a bug in it) should not affect the #vcpu
> == #queue case's
> behavior.  I don't quite understand what property we'd be changing
> with the patch.
> 
> Here's the same dump of smp_affinity_list, on a 16 VCPU machine with
> unmodified kernel:
> 
> 0
> 0
> 1
> 1
> 2
> 2
> [..]
> 15
> 15
> 
> And xps_cpus
> 00000001
> 00000002
> [...]
> 00008000
> 
> This patch causes #vcpu != #queue case to follow the same pattern.
> 
> 
> Thanks again!
> Ben

The logic is simple really. With #VCPUs == #queues we can reasonably
assume this box is mostly doing networking so we can set affinity
the way we like. With VCPUs > queues clearly VM is doing more stuff
so we need a userspace policy to take that into account,
we don't know ourselves what is the right thing to do.

Arguably for #VCPUs == #queues we are not always doing the right thing
either but I see this as an argument to move more smarts
into core kernel not for adding more dumb heuristics in the driver.

-- 
MST

  reply	other threads:[~2017-02-15 21:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 18:15 [PATCH v2 net-next] virtio: Fix affinity for #VCPUs != #queue pairs Ben Serebrin
2017-02-08 18:37 ` David Miller
2017-02-08 19:37 ` Michael S. Tsirkin
2017-02-14 19:17   ` Benjamin Serebrin
2017-02-14 21:05     ` Michael S. Tsirkin
2017-02-15 16:50       ` Willem de Bruijn
2017-02-15 17:42         ` Michael S. Tsirkin
2017-02-15 18:27           ` Benjamin Serebrin
2017-02-15 19:17             ` Michael S. Tsirkin
2017-02-15 21:38               ` Benjamin Serebrin
2017-02-15 21:49                 ` Michael S. Tsirkin [this message]
2017-02-15 22:13                   ` Benjamin Serebrin
2017-02-15 15:23     ` Michael S. Tsirkin

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=20170215234333-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=davem@davemloft.net \
    --cc=jasowang@redhat.com \
    --cc=jmattson@google.com \
    --cc=jonolson@google.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rick.jones2@hpe.com \
    --cc=serebrin@google.com \
    --cc=venkateshs@google.com \
    --cc=willemb@google.com \
    --cc=willemdebruijn.kernel@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).