Date: Fri, 7 Oct 2005 02:35:39 -0700 From: Luigi Rizzo <rizzo@icir.org> To: dima <_pppp@mail.ru> Cc: arch@freebsd.org, Gleb Smirnoff <glebius@freebsd.org> Subject: Re: [REVIEW/TEST] polling(4) changes Message-ID: <20051007023539.B5081@xorpc.icir.org> In-Reply-To: <E1ENoXC-000CxD-00._pppp-mail-ru@f44.mail.ru>; from _pppp@mail.ru on Fri, Oct 07, 2005 at 01:28:58PM %2B0400 References: <20051006183413.GH14542@cell.sick.ru> <E1ENoXC-000CxD-00._pppp-mail-ru@f44.mail.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
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@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-arch
> To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051007023539.B5081>
