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

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


On 30.06.2005 [00:24:10 +0300], Michael S. Tsirkin wrote:
> Quoting r. Nishanth Aravamudan <nacc at us.ibm.com>:
> > > > @@ -710,11 +711,12 @@
> > > >  		if (!accept_conn) {
> > > >  			DECLARE_WAITQUEUE(wait, current);
> > > >  			add_wait_queue(listen_sk->sk_sleep, &wait);
> > > > -			set_current_state(TASK_INTERRUPTIBLE);
> > > >  
> > > >  			while (timeout > 0 &&
> > > >  			       listen_conn->state == SDP_CONN_ST_LISTEN &&
> > > >  			       !listen_conn->backlog_cnt) {
> > > > +
> > > > +				set_current_state(TASK_INTERRUPTIBLE);
> > > >  				sdp_conn_unlock(listen_conn);
> > > >  				timeout = schedule_timeout(timeout);
> > > >  				sdp_conn_lock(listen_conn);
> 
> What is the reason set_current_state is done before sdp_conn_unlock
> and not just before schedule_timeout?

That's a good point; doesn't really matter where in the loop the set
happens as long as it is before, if Libor's version goes in, or after,
if my version does.

But, as I said, I think Libor's version might miss wake-up events.

Thanks,
Nish



More information about the general mailing list