Giant-free polling [PATCH]

dima _pppp at mail.ru
Fri Mar 11 05:55:27 PST 2005


>   Collegues,
> 
> On Tue, Mar 01, 2005 at 04:29:49PM -0800, Luigi Rizzo wrote:
> L> [cc-ing net at freebsd.org to get more opinions]
> 
> this good, that you have CC'ed net@, otherwise we would continue
> working in parallel without collaboration.

It's a pity you didn't read the complete thread,
thus the original version of my patch isn't valid anymore.

> 
> Here is attached patch made in a collaboration by ru, pjd and me.

I thought about using list also, but considered it to bring
too much overhead to the code. The original idea of handling arrays
seems to be very elegant.

> 
> We use separate mutex for polling, and we drop it before calling the
> poll handler to avoid LOR and contention on this mutex.

The recent version of the patch uses sx lock to protect pr[] and
the array of per-interface mutexes iface_locks[].
So, all CPUs can poll different interfaces at the same time now.
See the complete thread for details.

> 
> We have definite evidence that now idle_poll and ISR poll can run
> in parallel: if we remove PRF_RUNNING flag check, we got panics
> because poll handlers of many drivers (e.g. if_em) are not reentrable.
> 
> I think this patch is a step forward in direction of parallel polling
> on SMP, since we now have two polling instances (ISR + idle) working
> in parallel.

I also mentioned that poll_idle() isn't called from anywhere in the kernel.
Thus we have only 2 possible sources for polling: hardclock (per-CPU) and traps.
The polling code in trap handler should also be changed a bit to check for
the trap's source.

I attach the most recent version of the patch.
The only difference is locking in ether_poll_register() suggested by Luigi.

> 
> -- 
> Totus tuus, Glebius.
> GLEBIUS-RIPN GLEB-RIPE

-------------- next part --------------
A non-text attachment was scrubbed...
Name: kern_poll.patch
Type: application/octet-stream
Size: 4442 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20050311/8279cd6b/kern_poll.obj


More information about the freebsd-net mailing list