2004-01-17 18:46:50

by Manfred Spraul

[permalink] [raw]
Subject: [PATCH] remove sleep_on from sunrpc

--- 2.6/net/sunrpc/sched.c 2004-01-17 12:19:50.000000000 +0100
+++ build-2.6/net/sunrpc/sched.c 2004-01-17 12:52:33.000000000 +0100
@@ -1060,7 +1060,7 @@
void
rpciod_down(void)
{
- unsigned long flags;
+ DECLARE_WAITQUEUE(wait, current);

down(&rpciod_sema);
dprintk("rpciod_down pid %d sema %d\n", rpciod_pid, rpciod_users);
@@ -1085,17 +1085,22 @@
/*
* Display a message if we're going to wait longer.
*/
- while (rpciod_pid) {
+ add_wait_queue(&rpciod_killer, &wait);
+ for (;;) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ if (rpciod_pid == 0)
+ break;
dprintk("rpciod_down: waiting for pid %d to exit\n", rpciod_pid);
if (signalled()) {
dprintk("rpciod_down: caught signal\n");
break;
}
- interruptible_sleep_on(&rpciod_killer);
+ schedule();
}
- spin_lock_irqsave(&current->sighand->siglock, flags);
+ remove_wait_queue(&rpciod_killer, &wait);
+ spin_lock_irq(&current->sighand->siglock);
recalc_sigpending();
- spin_unlock_irqrestore(&current->sighand->siglock, flags);
+ spin_unlock_irq(&current->sighand->siglock);
out:
up(&rpciod_sema);
}





Attachments:
patch-sleep_on_sunrpc (1.07 kB)

2004-01-18 01:42:48

by Peter Osterlund

[permalink] [raw]
Subject: Re: [PATCH] remove sleep_on from sunrpc

Manfred Spraul <[email protected]> writes:

> - while (rpciod_pid) {
> + add_wait_queue(&rpciod_killer, &wait);
> + for (;;) {
> + set_current_state(TASK_INTERRUPTIBLE);
> + if (rpciod_pid == 0)
> + break;
> dprintk("rpciod_down: waiting for pid %d to exit\n", rpciod_pid);
> if (signalled()) {
> dprintk("rpciod_down: caught signal\n");
> break;
> }
> - interruptible_sleep_on(&rpciod_killer);
> + schedule();
> }
> - spin_lock_irqsave(&current->sighand->siglock, flags);
> + remove_wait_queue(&rpciod_killer, &wait);
> + spin_lock_irq(&current->sighand->siglock);
> recalc_sigpending();
> - spin_unlock_irqrestore(&current->sighand->siglock, flags);
> + spin_unlock_irq(&current->sighand->siglock);
> out:
> up(&rpciod_sema);
> }

Aren't you forgetting to set_current_state(TASK_RUNNING) after the
loop?

--
Peter Osterlund - [email protected]
http://w1.894.telia.com/~u89404340