linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gianni Tedesco <gianni@scaramanga.co.uk>
To: odain2@mindspring.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: CONFIG_PACKET_MMAP revisited
Date: Thu, 06 Nov 2003 12:08:34 +0100	[thread overview]
Message-ID: <1068116914.6144.1410.camel@lemsip> (raw)
In-Reply-To: <176730-2200310329491330@M2W026.mail2web.com>

[-- Attachment #1: Type: text/plain, Size: 1280 bytes --]

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


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2003-11-06 11:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-29  4:09 CONFIG_PACKET_MMAP revisited odain2
2003-10-29  4:50 ` Jamie Lokier
2003-11-06 11:08 ` Gianni Tedesco [this message]
2003-11-06 14:13   ` Oliver Dain
2003-11-06 14:31     ` Gianni Tedesco
2003-11-06 15:29       ` P

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1068116914.6144.1410.camel@lemsip \
    --to=gianni@scaramanga.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=odain2@mindspring.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).