From: Nadav Har'El Subject: Re: [PATCH] vhost: don't forget to schedule() Date: Sun, 4 Mar 2012 11:10:01 +0200 Message-ID: <20120304091001.GA4379@fermat.math.technion.ac.il> References: <20120227130729.GA9880@fermat.math.technion.ac.il> <4F4CD18D.6000703@redhat.com> <20120228140020.GA8903@fermat.math.technion.ac.il> <4F4CE4B6.5020407@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, mst@redhat.com, abelg@il.ibm.com To: Avi Kivity Return-path: Received: from mailgw12.technion.ac.il ([132.68.225.12]:53311 "EHLO mailgw12.technion.ac.il" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751654Ab2CDJKJ (ORCPT ); Sun, 4 Mar 2012 04:10:09 -0500 Content-Disposition: inline In-Reply-To: <4F4CE4B6.5020407@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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? > > 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.