Re: [patch 00/13] Syslets, "Threadlets", generic AIO support, v3
From: Davide Libenzi
Date: Sat Mar 03 2007 - 16:57:28 EST
On Sat, 3 Mar 2007, Evgeniy Polyakov wrote:
> > I was referring to dropping an event directly to a userspace buffer, from
> > the poll callback. If pages are not there, you might sleep, and you can't
> > since the wakeup function holds a spinlock on the waitqueue head while
> > looping through the waiters to issue the wakeup. Also, you don't know from
> > where the poll wakeup is called.
>
> Ugh, no, that is very limited solution - memory must be either pinned
> (which leads to dos and limited ring buffer), or callback must sleep.
> Actually in any way there _must_ exist a queue - if ring buffer is full
> event is not allowed to be dropped - it must be stored in some other
> place, for example in queue from where entries will be read (copied)
> which ring buffer will have entries (that is how it is implemented in
> kevent at least).
I was not advocating for that, if you read carefully. The fact that epoll
does not do that, should be a clear hint. The old /dev/epoll IIRC was only
10% faster than the current epoll under an *heavy* event frequency
micro-bench like pipetest (and that version of epoll did not have the
single pass over the ready set optimization). And /dev/epoll was
delivering events *directly* on userspace visible (mmaped) memory in a
zero-copy fashion.
> > BTW, Linus made a signalfd sketch code time ago, to deliver signals to an
> > fd. Code remained there and nobody cared. Question: Was it because
> > 1) it had file bindings or 2) because nobody really cared to deliver
> > signals to an event collector?
> > And *if* later requirements come, you don't need to change the API by
> > adding an XXEVENT_SIGNAL_ADD or XXEVENT_TIMER_ADD, or creating a new
> > XXEVENT-only submission structure. You create an API that automatically
> > makes that new abstraction work with POSIX poll/select, and you get epoll
> > support for free. Without even changing a bit in the epoll API.
>
> Well, we get epoll support for free, but we need to create tons of other
> interfaces and infrastructure for kernel users, and we need to change
> userspace anyway.
Those *other* (tons?!?) interfaces can be created *when* the need comes
(see Linus signalfd [1] example to show how urgent that was). *When*
the need comes, they will work with existing POSIX interfaces, without
requiring your own just-another event interface. Those other interfaces
could also be more easily adopted by other Unix cousins, because of
the fact that they rely on existing POSIX interfaces. One of the reason
about the Unix file abstraction interfaces, is that you do *not* have to
plan and bloat interfaces before. As long as your new abstraction behave
in a file-fashion, it can be automatically used with existing interfaces.
And you create them *when* the need comes.
[1] That was like 100 lines of code or so. See here:
http://tinyurl.com/3yuna5
- Davide
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/