Problems with sched_yield in 2.0.30 (fwd)

Gordon Chaffee (chaffee@linus.cs.berkeley.edu)
Tue, 6 May 1997 14:37:57 -0700 (PDT)


------- start of forwarded message -------
Path: agate!howland.erols.net!news.mathworks.com!blanket.mitre.org!raptor.com!not-for-mail
From: Philip Gladstone <philip@raptor.com>
Newsgroups: comp.os.linux.development.system
Subject: Problems with sched_yield in 2.0.30
Date: Tue, 06 May 1997 15:58:20 -0400
Organization: Raptor Systems
Lines: 28
Message-ID: <336F8D5C.1990@raptor.com>
NNTP-Posting-Host: zaphod.raptor.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.01 (WinNT; I)
Xref: agate comp.os.linux.development.system:50920

Has anyone else noticed that sched_yield() doesn't work?
The calling process just continues on quite happily.

Anyway, here is a patch that makes it work:

--- kernel/sched.c.orig Fri May 2 08:43:07 1997
+++ kernel/sched.c Fri May 2 09:37:21 1997
@@ -1459,9 +1459,12 @@
asmlinkage int sys_sched_yield(void)
{
cli();
- move_last_runqueue(current);
+ if (current->next_run) {
+ move_last_runqueue(current);
+ current->counter = 0;
+ need_resched = 1;
+ }
sti();
- need_resched = 1;
return 0;
}

Philip

p.s. Who is dealing with patches in this area these days?

-- 
Philip Gladstone                           +1 617 487 7700
Raptor Systems, Waltham, MA         http://www.raptor.com/
------- end of forwarded message -------