Re: sched_yield() on "SCHED_FIFO"

NIIBE Yutaka (gniibe@chroot.org)
Sat, 31 Jul 1999 10:35:47 +0900


I wrote:
> I think that I've found the cause of the problem.
>
> --------------------------- kernel/sched.c
> asmlinkage int sys_sched_yield(void)
> {
> spin_lock_irq(&runqueue_lock);
> if (current->policy == SCHED_OTHER) <---------- This line.
> current->policy |= SCHED_YIELD;
> current->need_resched = 1;
> move_last_runqueue(current);
> spin_unlock_irq(&runqueue_lock);
> return 0;
> }
> ---------------------------
>
> This line was introduced on November 1998 in the patch-2.1.127.
> Without this conditional (set SCHED_YIELD flag regardless of policy),
> I guess it works fine.

Richard Gooch writes:
> I'm the author of that patch, and it's the correct behaviour. Read the
> spec. If a RT process "yields" to a SCHED_OTHER process, the RT
> process should keep running. It should *not* give CPU time to the
> SCHED_OTHER process.

Thank you for prompt reply. It's really great thing that we can reach
the author in that way.

Well, I've read the spec, of Unix98 and O'Reilly's "POSIX.4". You're
right that RT process should never "yields" to a SCHED_OTHER process.

However, the case which Suzaki-san provided is two _RT_ processes.

In the current (2.2.10) implementation (with the "if" clause), RT
process never yields (even to the another RT process). That's the
point I'd like to point out.

How do you think?

-- 
Niibe Yutaka

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/