mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Lemon <jlemon@flugsvamp.com>
To: Dan Kegel <dank@alumni.caltech.edu>,
	Linus Torvalds <torvalds@transmeta.com>,
	linux-kernel@vger.kernel.org
Subject: Re: Linux's implementation of poll() not scalable?
Date: Thu, 26 Oct 2000 20:35:45 -0500 (CDT)	[thread overview]
Message-ID: <200010270135.e9R1ZjS39822@prism.flugsvamp.com> (raw)
In-Reply-To: <local.mail.linux-kernel/39F8D09B.F55AD0FD@alumni.caltech.edu>
In-Reply-To: <local.mail.linux-kernel/Pine.LNX.4.10.10010260936330.2460-100000@penguin.transmeta.com>

In article <local.mail.linux-kernel/39F8D09B.F55AD0FD@alumni.caltech.edu> you write:
>Linus Torvalds wrote:
>> I'd much rather have an event interface that is documented to be edge-
>> triggered and is really _lightweight_, than have another interface that
>> starts out with some piggy features.
>
>Agreed (except for that 'edge-triggered' part), but I don't think
>'level-triggered' implies piggy.   I haven't benchmarked whether
>kqueue() slows down the networking layer of FreeBSD yet; do you
>suspect maintaining the level-triggered structures actually is
>a bottleneck for them?

I really don't think it's a bottleneck.  At the moment, all events
are maintained on a linked list.  To dequeue an event, we simply:

	1. take the event on the front of the list.
	2. validate event.  (call filter function)
	3. copy event into return array.
	4. put event back on end of list.

If the `EV_ONESHOT' flag is set, we skip steps 2 & 4, and destroy
the event after it is returned to the user.
    (we want to wait only once for this particular event)

If the `EV_CLEAR' flag is set, we skip step 4.
    (pure edge-triggered delivery)

Step 4 is pretty simple, just re-insertion back onto the queue.

If you eliminate Step 2, then you have a `correctness' issue; where
the application must deal with stale events.  The validation function
is equally lightweight and doesn't (IMO) cause a performance problem.


>> ... the "re-bind()" approach works very simply, and means that the
>> overhead of testing whether the event is still active is not a generic
>> thing that _always_ has to be done, but something where the application
>> can basically give the kernel the information that "this time we're
>> leaving the event possibly half-done, please re-test now".
>
>Hmm.  I don't like the extra system call, though.  Any chance you'd be
>willing to make get_events() take a vector of bind requests, so we can
>avoid the system call overhead of re-binding?  (Or is that too close
>to kqueue for you?)

IMO, I'd think that the calls should be orthogonal.  If the "get_events()"
call returns an array, why shouldn't the "bind_request()" call as well?
Otherwise you're only amortizing the system calls in one direction.


>And are you sure apps will always know whether they need to rebind?
>Sometimes you're faced with a protocol stack which may or may not
>read the requests fully, and which you aren't allowed to change.
>It'd be nice to still have a high-performance interface that can deal with 
>that situation.

Agreed.
--
Jonathan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

       reply	other threads:[~2000-10-27  1:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <local.mail.linux-kernel/39F8D09B.F55AD0FD@alumni.caltech.edu>
     [not found] ` <local.mail.linux-kernel/Pine.LNX.4.10.10010260936330.2460-100000@penguin.transmeta.com>
2000-10-27  1:35   ` Jonathan Lemon [this message]
     [not found] <39F529CC.2538300@alumni.caltech.edu>
2000-10-30 22:22 ` Mike Jagdis
2000-11-01 16:09   ` Dan Kegel
2000-10-28  0:46 John Gardiner Myers
     [not found] <Pine.LNX.4.10.10010241121340.1704-100000@penguin.transmeta.com>
     [not found] ` <39F61766.FC5D2D81@alumni.caltech.edu>
     [not found]   ` <39F6A412.DE378865@idb.hist.no>
     [not found]     ` <39F7054C.72FB3EA8@alumni.caltech.edu>
     [not found]       ` <m1aebs9i74.fsf@frodo.biederman.org>
2000-10-26 16:20         ` Dan Kegel
2000-10-26 16:44           ` Linus Torvalds
2000-10-26 19:51             ` Jim Gettys
2000-10-26 21:48               ` Dan Kegel
2000-10-27 13:56               ` Chris Swiedler
2000-10-27  0:47             ` Dan Kegel

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=200010270135.e9R1ZjS39822@prism.flugsvamp.com \
    --to=jlemon@flugsvamp.com \
    --cc=dank@alumni.caltech.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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

all inboxes | Powered by JetHome®