From: Nadav Har'El Subject: Re: [PATCH] vhost: don't forget to schedule() Date: Tue, 28 Feb 2012 16:00:20 +0200 Message-ID: <20120228140020.GA8903@fermat.math.technion.ac.il> References: <20120227130729.GA9880@fermat.math.technion.ac.il> <4F4CD18D.6000703@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]:44986 "EHLO mailgw12.technion.ac.il" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750831Ab2B1OA0 (ORCPT ); Tue, 28 Feb 2012 09:00:26 -0500 Content-Disposition: inline In-Reply-To: <4F4CD18D.6000703@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 kernel... Unfortunately, I am not astute (or experienced) enough to tell which of the two idioms are better or more appropriate for this case. The idiom that I used seemed right, and seemed to work in my tests. Moreover I also noticed it was used in vmx.c. Also, vhost.c was already calling schedule(), not cond_resched(), so I thought it made sense to call the same thing... But I now see that in kvm_main.c, there's also this: if (!need_resched()) return; cond_resched(); Which seems to combine both idioms ;-) Can anybody shed a light on what is the right way to do it? -- Nadav Har'El | Tuesday, Feb 28 2012, nyh@math.technion.ac.il |----------------------------------------- Phone +972-523-790466, ICQ 13349191 |I am logged in, therefore I am. http://nadav.harel.org.il |