On Tue, Apr 4, 2017 at 10:56 PM, Mike Galbraith <[email protected]> wrote: > On Tue, 2017-04-04 at 22:19 -0700, Cong Wang wrote: >> On Tue, Apr 4, 2017 at 8:55 PM, Mike Galbraith <[email protected]> wrote: > >> > That won't help, cond_resched() has the same impact upon a lone >> > SCHED_FIFO task as yield() does.. none. >> >> Hmm? In the comment you quote: >> >> * If you want to use yield() to wait for something, use wait_event(). >> * If you want to use yield() to be 'nice' for others, use cond_resched(). >> >> So if cond_resched() doesn't help, why this misleading comment? > > This is not an oh let's be nice guys thing, it's a perfect match of... > > <copy/paste> > * while (!event) > * yield(); > (/copy/paste> > > ..get off the CPU until this happens thing. With nobody to yield the C > PU to, some_qdisc_is_busy() will remain true forever more.
This is exactly the misleading part, a while-loop waiting for an event can always be a be-nice-for-others thing, because if not we can just spin as a spinlock. You probably want to improve that comment to explain when cond_resched() is a right solution to replace yield(), so that I could know when it is not. Thanks.
