Re: Processes freezing in D state

Andrea Arcangeli (andrea@e-mind.com)
Tue, 26 Jan 1999 01:14:39 +0100 (CET)


On Mon, 25 Jan 1999, Stephen C. Tweedie wrote:

> Hi,
>
> On Fri, 22 Jan 1999 11:04:04 -0500, Andrew Lewycky
> <amplewycky@undergrad.math.uwaterloo.ca> said:
>
> > Once under 2.2.0-pre8 and once under 2.2.0-final, I've had many of the
> > processes on my system simultaneously enter the D state.
>
> "ps -axl" is the best way to start diagnosing this. You'll need the
> patch below to fix wchan on pre9.

On the list it's flying a better fix. You can reach the real kernel stack
of any process using _only_ the data in the task struct (so also the copy
of data in the task struct is enough). `*(tsk)->tarray_ptr' will give you
the pointer to the start of the real stack of process `tsk'.

To debug the semaphore deadlock you can use also this my code. Simply
apply it,reboot recompile, deadlock and wait 20 sec:

Index: sched.c
===================================================================
RCS file: /var/cvs/linux/kernel/sched.c,v
retrieving revision 1.1.1.1.2.37
diff -u -r1.1.1.1.2.37 sched.c
--- sched.c 1999/01/07 11:57:23 1.1.1.1.2.37
+++ sched.c 1999/01/08 10:41:53
@@ -22,6 +22,10 @@
* current-task
*/

+/*
+ * Debug down() code. Copyright (C) 1999 Andrea Arcangeli
+ */
+
#include <linux/mm.h>
#include <linux/kernel_stat.h>
#include <linux/fdreg.h>
@@ -893,12 +897,27 @@
tsk->state = TASK_RUNNING; \
remove_wait_queue(&sem->wait, &wait);

+void generate_oops (struct semaphore *sem)
+{
+ sema_init(sem, 9876);
+ wake_up(&sem->wait);
+}
+
void __down(struct semaphore * sem)
{
DOWN_VAR
+ struct timer_list timer;
+ init_timer (&timer);
+ timer.expires = jiffies + HZ*20;
+ timer.data = (unsigned long) sem;
+ timer.function = (void (*)(unsigned long)) generate_oops;
+ add_timer(&timer);
DOWN_HEAD(TASK_UNINTERRUPTIBLE)
schedule();
+ if (atomic_read(&sem->count) == 9876)
+ *(int *) 0 = 0;
DOWN_TAIL(TASK_UNINTERRUPTIBLE)
+ del_timer(&timer);
}

int __down_interruptible(struct semaphore * sem)

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