Re: thundering pipe herds

2020-11-23 Thread David Holland
On Tue, Nov 24, 2020 at 09:09:59AM +1100, matthew green wrote:
 > > @@ -395,9 +401,8 @@ pipeunlock(struct pipe *pipe)
 > >KASSERT(pipe->pipe_state & PIPE_LOCKFL);
 > >  
 > >pipe->pipe_state &= ~PIPE_LOCKFL;
 > > -  if (pipe->pipe_state & PIPE_LWANT) {
 > > -  pipe->pipe_state &= ~PIPE_LWANT;
 > > -  cv_broadcast(>pipe_lkcv);
 > > +  if (pipe->pipe_waiters > 0) {
 > > +  cv_signal(>pipe_lkcv);
 > >}
 > >  }
 > 
 > this part misses the while loop from the freebsd version i think?

...shouldn't, that would turn it back into broadcast.

(except not even that, because the decrement doesn't happen until
wakeup so it'd loop forever)

-- 
David A. Holland
dholl...@netbsd.org


re: thundering pipe herds

2020-11-23 Thread matthew green
> @@ -395,9 +401,8 @@ pipeunlock(struct pipe *pipe)
>   KASSERT(pipe->pipe_state & PIPE_LOCKFL);
>  
>   pipe->pipe_state &= ~PIPE_LOCKFL;
> - if (pipe->pipe_state & PIPE_LWANT) {
> - pipe->pipe_state &= ~PIPE_LWANT;
> - cv_broadcast(>pipe_lkcv);
> + if (pipe->pipe_waiters > 0) {
> + cv_signal(>pipe_lkcv);
>   }
>  }

this part misses the while loop from the freebsd version i think?


.mrg.