tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: select/poll optimization



On Sun, Feb 24, 2008 at 05:35:51PM +0000, Andrew Doran wrote:
> > >   http://www.netbsd.org/~ad/percpu-select.diff
> > > 
> > > Comments?
> > 
> > I think it doesn't work !
> > 
> > You've not allowed for more than one lwp (using different mutex)
> > being in selrecord() for the same device at the same time.
> > Also:
> > +           /* Multiple waiters: record a collision. */
> > +           sip->sel_collision |= sc->sc_mask;
> > needs to be locked - or you lose bits in sel_collision.
> 
> It's not a problem because the caller (eg device driver) provides mutual
> exclusion around calls to selrecord/selwakeup. See the comments at the top
> of both functions. That might be kernel_lock or to use pipes as an example,
> the pipe's mutex.

Ok, it wasn't clear that the driver code is required to hold a spinlock
across all calls to selrecord/wakeup in order to lock the 'struct selinfo'.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index