From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Nadav Har'El" <nyh@math.technion.ac.il>
Cc: Avi Kivity <avi@redhat.com>, kvm@vger.kernel.org, abelg@il.ibm.com
Subject: Re: [PATCH] vhost: don't forget to schedule()
Date: Sun, 4 Mar 2012 11:16:44 +0200 [thread overview]
Message-ID: <20120304091643.GA2275@redhat.com> (raw)
In-Reply-To: <20120304091001.GA4379@fermat.math.technion.ac.il>
On Sun, Mar 04, 2012 at 11:10:01AM +0200, Nadav Har'El wrote:
> On Tue, Feb 28, 2012, Avi Kivity wrote about "Re: [PATCH] vhost: don't forget to schedule()":
> > > > > + if (need_resched())
> > > > > + schedule();
> > > > This is cond_resched(), no?
> > >
> > > It indeed looks similar, but it appears there are some slightly
> > > different things happening in both cases, especially for a preemptive
> >...
> > I'd have expected that cond_resched() is a no-op with preemptible
> > kernels, but I see this is not the case.
>
> Hi. This discussion is already getting several orders of magnitude longer
> than the patch :-)
>
> Would you like me to send a new one-line patch calling "cond_resched()"
> instead of need_resched/schedule? Or anything else that I can do?
The argument is mostly about what's faster, right?
You can push the argument along if you run some benchmarks to show the
performance impact of the proposed variants.
Measure bandwidth (using e.g. netperf) divided by host CPU utilization
(note: netperf reports guest utilization, that is mostly not
interesting, use something like mpstat to measure on host),
and compare between baseline, your patch, cond_resched, whatever else
you come up with.
> > > But I now see that in kvm_main.c, there's also this:
> > >
> > > if (!need_resched())
> > > return;
> > > cond_resched();
> >...
> >
> > It's bogus. Look at commit 3fca03653010:
> >...
> > + if (!need_resched())
> > + return;
> > vcpu_put(vcpu);
> > cond_resched();
> > vcpu_load(vcpu);
> >
> > at that time, it made sense to do the extra check to avoid the expensive
> > vcpu_put/vcpu_load. Later preempt notifiers made them redundant
> > (15ad71460d75), and they were removed, but the extra check remained.
>
> Do you want a patch to remove this extra check? Or you can just remove
> it yourself?
>
> Thanks,
> Nadav.
>
> --
> Nadav Har'El | Sunday, Mar 4 2012,
> nyh@math.technion.ac.il |-----------------------------------------
> Phone +972-523-790466, ICQ 13349191 |As every cat owner knows, nobody owns a
> http://nadav.harel.org.il |cat.
next prev parent reply other threads:[~2012-03-04 9:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-27 13:07 [PATCH] vhost: don't forget to schedule() Nadav Har'El
2012-02-28 13:07 ` Avi Kivity
2012-02-28 14:00 ` Nadav Har'El
2012-02-28 14:29 ` Avi Kivity
2012-03-04 9:10 ` Nadav Har'El
2012-03-04 9:16 ` Michael S. Tsirkin [this message]
2012-03-18 13:55 ` Nadav Har'El
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=20120304091643.GA2275@redhat.com \
--to=mst@redhat.com \
--cc=abelg@il.ibm.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=nyh@math.technion.ac.il \
/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).