[openib-general] [PATCH] sdp_inet: fix schedule_timeout() usage
Nishanth Aravamudan
nacc at us.ibm.com
Tue Jun 28 13:48:55 PDT 2005
Hello,
My first patch to openib-general. Let me know if I diffed from the wrong
directory or anything else.
Thanks,
Nish
Using schedule_timeout() without setting the state first is broken and
causes schedule_timeout() to return immediately (effectively you call
schedule() without changing your state and are thus going to run again).
In each of these loops in sdp_inet.c involving schedule_timeout(), the
first iteration is correct, but subsequent ones result in busy-wait. Add
the appropriate set_current_state() call to fix the issue.
Signed-off-by: Nishanth Aravamudan <nacc at us.ibm.com>
Index: trunk/src/linux-kernel/infiniband/ulp/sdp/sdp_inet.c
===================================================================
--- trunk/src/linux-kernel/infiniband/ulp/sdp/sdp_inet.c (revision 2734)
+++ trunk/src/linux-kernel/infiniband/ulp/sdp/sdp_inet.c (working copy)
@@ -388,6 +388,7 @@ static int sdp_inet_release(struct socke
if (signal_pending(current))
break;
+ set_current_state(TASK_INTERRUPTIBLE);
}
set_current_state(TASK_RUNNING);
@@ -627,6 +628,7 @@ static int sdp_inet_connect(struct socke
break;
}
+ set_current_state(TASK_INTERRUPTIBLE);
}
set_current_state(TASK_RUNNING);
@@ -782,6 +784,7 @@ static int sdp_inet_accept(struct socket
if (signal_pending(current))
break;
+ set_current_state(TASK_INTERRUPTIBLE);
}
set_current_state(TASK_RUNNING);
More information about the general
mailing list