From: [EMAIL PROTECTED] (Alan Cox)
Date: Fri, 18 Dec 1998 15:50:03 +0000 (GMT)
> if (current->need_resched != 0 ||
> ((p = init_task.next_run) != NULL &&
> (p->processor == smp_processor_id() ||
> (p->tss.flags & SPARC_FLAG_NEWCHILD) != 0)))
> schedule();
Given the races in the above have you proved they work out safely. Thats
the first thing I looked at and why I never looked further at your example
What races? Here is my proof:
1) We always dereference a non-NULL pointer.
2) We always only read and act upon the results of those
reads as a heuristic.
So what if the task struct gets freed and someone scrambles over it?
We'll just read corrupt data and at worst that can happen is that you
prematurely go into the scheduler or don't when you should have and go
around the loop one more time.
Ohhh, dangerous races :-)))
We already do stuff like this, see sys_getppid().
Later,
David S. Miller
[EMAIL PROTECTED]
-
Linux SMP list: FIRST see FAQ at http://www.irisa.fr/prive/mentre/smp-faq/
To Unsubscribe: send "unsubscribe linux-smp" to [EMAIL PROTECTED]