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@xxxxxxxxxxxxxxxxxxx |----------------------------------------- Phone +972-523-790466, ICQ 13349191 |I am logged in, therefore I am. http://nadav.harel.org.il | -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html