Re: your mail

Michael K. Johnson (johnsonm@redhat.com)
Tue, 01 Apr 1997 16:39:48 -0500


Alan Cox writes:
>Myth warning. If your process happens to running real time this doesnt come
>out too well. I guess you might argue the behaviour (not yielding) is right
>but you might get some suprises, especially on an SMP box where the following
>is not safe
>
> while(!irq_occured)
> schedule();
>
>Take a look at stuff like sched_yield()

Well, the original poster wasn't using kernel threads, as I understood,
and polling with schedule() has never been a hot idea anyway -- that's
why I have the KHG cover wait queues a little bit...

It sounds like the rule is now:
o You can use schedule() when you just want to possibly give time
to other processes, modulo scheduling policy now in effect. After
all, schedule() didn't always yield in the past; it only yielded if
there was any reason to do so.
o Don't poll with schedule()! It's never been the right thing to
do; that's what wait queues are for. Now this bad idea is unsafe
on SMP boxes.
o If you are writing a kernel thread, then pay attention to how you
have set the scheduling hints for the thread and understand that
they will affect your scheduling (obviously). See sched_yield() for
more information (I haven't seen it so I can't say anything more).

Is that about right?

michaelkjohnson

"Ever wonder why the SAME PEOPLE make up ALL the conspiracy theories?"