Messages in this thread | | | Subject | Re: CONFIG_PACKET_MMAP revisited | From | Gianni Tedesco <> | Date | Thu, 06 Nov 2003 12:08:34 +0100 |
| |
On Wed, 2003-10-29 at 05:09, odain2@mindspring.com wrote: > I believe that in normal operation each packet > (or with NICs that do interrupt coalescing, every n packets) causes an > interrupt which causes a context switch, the kernel then copies the data > from the DMA buffer to the shared buffer and does a RETI. That's fairly > expensive.
The cost of handling that interrupt and doing an iret is unavoidable (ignoring NAPI). The main point you are missing with the ring buffer is that if packets come in at a fast enough rate, the usermode task never context switches, because there is always data in the ring buffer, so it loops in usermode forever.
The problem could be the packets are coming in just too slow to allow the ring buffer to work properly and causing the application to sleep on poll(2) every time. This would kill performance at pathelogical packet rates I guess.
You could work around this by spinning for a few thousand spins before calling poll(2) (or even indefinately for that matter, and allow the kernel to preempt you if need be).
-- // Gianni Tedesco (gianni at scaramanga dot co dot uk) lynx --source www.scaramanga.co.uk/gianni-at-ecsc.asc | gpg --import 8646BE7D: 6D9F 2287 870E A2C9 8F60 3A3C 91B5 7669 8646 BE7D
[unhandled content-type:application/pgp-signature] | |