tech-kern archive

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

select/poll optimization



Hi,

Currently select() and poll() synchronize using a global mutex. The below
diff changes them to use per-CPU state, and removes the locking in
selrecord(). In the best case there is no lock contention internal to
select() or poll() with the patch, and in the worse case, all state is
hashed out by a factor of $ncpu so it should scale as CPUs are added.

In the few tests I have done there is either no lock contention or it's just
background noise. rmind@ and I have been discussing an approach using a
'thread x descriptor' array to store state, and do fine grained locking
based on that, but I think the per-CPU approach is better because a lot less
synchronization is needed, and no changes are needed to drivers.

        http://www.netbsd.org/~ad/percpu-select.diff

Comments?

Thanks,
Andrew


Home | Main Index | Thread Index | Old Index