[patch] schedule_timeout updates

Andrea Arcangeli (andrea@e-mind.com)
Fri, 27 Nov 1998 11:53:24 +0100 (CET)


This make schedule_timeout() more pedantic... The case of entering
schedule_timeout() with current->state == TASK_RUNNING seems needed at
least from the network and tty poll.

Index: linux/kernel/sched.c
diff -u linux/kernel/sched.c:1.1.1.2 linux/kernel/sched.c:1.1.1.1.2.13
--- linux/kernel/sched.c:1.1.1.2 Fri Nov 27 11:19:09 1998
+++ linux/kernel/sched.c Fri Nov 27 11:41:41 1998
@@ -7,6 +7,8 @@
* 1996-12-23 Modified by Dave Grothe to fix bugs in semaphores and
* make semaphores SMP safe
* 1997-01-28 Modified by Finn Arne Gangstad to make timers scale better.
+ * 1998-11-19 Implemented schedule_timeout() and related stuff
+ * by Andrea Arcangeli
*/

/*
@@ -437,17 +451,18 @@
struct timer_list timer;
unsigned long expire;

- /*
- * PARANOID.
- */
- if (current->state == TASK_UNINTERRUPTIBLE)
+ switch (current->state)
{
- printk(KERN_WARNING "schedule_timeout: task not interrutible "
- "from %p\n", __builtin_return_address(0));
+ case TASK_INTERRUPTIBLE:
+ case TASK_RUNNING:
+ break;
+ default:
/*
* We don' t want to interrupt a not interruptible task
* risking to cause corruption. Better a a deadlock ;-).
*/
+ printk(KERN_ERR "schedule_timeout: task state %ld, from %p!\n",
+ current->state, __builtin_return_address(0));
timeout = MAX_SCHEDULE_TIMEOUT;
}

I added also a line of credits... ;)

Andrea Arcangeli

-
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/