[openib-general] [PATCH] sdp_inet: fix schedule_timeout() usage

Nishanth Aravamudan nacc at us.ibm.com
Wed Jun 29 14:17:54 PDT 2005


On 29.06.2005 [11:14:40 -0700], Libor Michalek wrote:
> On Tue, Jun 28, 2005 at 01:48:55PM -0700, Nishanth Aravamudan wrote:
> >
> > 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.
> 
> Nish,
> 
>   Thank you for the patch. I'm wondering if it would be better to just
> move the existing call to set_current_state(TASK_INTERRUPTIBLE) from
> outside the loop to inside at the begining, as below?

The problem with that change is that since the task-state has not
changed, you may miss some signal-related wake-ups before you set the
state. Really, you probably could use prepare_to_wait() and
finish_wait() for all of this?

Thanks,
Nish



More information about the general mailing list