[REVIEW/TEST] polling(4) changes
Luigi Rizzo
rizzo at icir.org
Fri Oct 7 02:35:40 PDT 2005
On Fri, Oct 07, 2005 at 01:28:58PM +0400, dima wrote:
> > d> Seems to be a first considerable step regarding the ideas discussed in March :)
> > d> But, my idea about the separate locking of each interface dissappeared from this implementation. mtx_poll is good to protect the pollrec array and other sensitive variables. But we could get advantage of SMP machines writing polling loops like this:
> > d>
> > d> for( i = 0; i < poll_handlers; ++i ) {
> > d> mtx_lock( &iface_lock[i] );
> > d> pr[i].handler(pr[i].ifp, POLL_ONLY, count);
> > d> mtx_unlock( &iface_lock[i] );
> > d> }
> >
> > What is the benefit here? The driver must have its own lock.
>
> Well, consider the absense of the mtx_poll lock:
>
> - mtx_lock( &mtx_poll );
> for( i = 0; i < poll_handlers; ++i ) {
> + mtx_lock( &iface_lock[i] );
> pr[i].handler( pr[i].ifp, POLL_ONLY, count );
> + mtx_unlock( &iface_lock[i] );
> }
> - mtx_unlock( &mtx_poll );
>
> So, several kernel threads in an SMP machine can poll different interfaces simultaneously. And mtx_lock should only be used in ether_poll_[de]register().
and spend their time fighting for the locks.
The "ideas discussed in march" tried to point out exactly that problem.
cheers
luigi
> _______________________________________________
> freebsd-arch at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-arch
> To unsubscribe, send any mail to "freebsd-arch-unsubscribe at freebsd.org"
More information about the freebsd-arch
mailing list