[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0702261149140.1881@alien.or.mcafeemobile.com>
Date: Mon, 26 Feb 2007 12:02:51 -0800 (PST)
From: Davide Libenzi <davidel@...ilserver.org>
To: Ingo Molnar <mingo@...e.hu>
cc: Evgeniy Polyakov <johnpol@....mipt.ru>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Arjan van de Ven <arjan@...radead.org>,
Christoph Hellwig <hch@...radead.org>,
Andrew Morton <akpm@....com.au>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
Ulrich Drepper <drepper@...hat.com>,
Zach Brown <zach.brown@...cle.com>,
"David S. Miller" <davem@...emloft.net>,
Suparna Bhattacharya <suparna@...ibm.com>,
Jens Axboe <jens.axboe@...cle.com>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [patch 00/13] Syslets, "Threadlets", generic AIO support, v3
On Mon, 26 Feb 2007, Ingo Molnar wrote:
>
> * Ingo Molnar <mingo@...e.hu> wrote:
>
> > please also try evserver_epoll_threadlet.c that i've attached below -
> > it uses epoll as the main event mechanism but does threadlets for
> > request handling.
>
> find updated code below - your evserver_epoll.c spuriously missed event
> edges - so i changed it back to level-triggered. While that is not as
> fast as edge-triggered, it does not result in spurious hangs and
> workflow 'hickups' during the test.
>
> Could this be the reason why in your testing kevents outperformed epoll?
This is how I handle a read (write/accept/connect, same thing) inside
coronet (coroutine+epoll async library - http://www.xmailserver.org/coronet-lib.html ).
static int conet_read_ll(struct sk_conn *conn, char *buf, int nbyte) {
int n;
while ((n = read(conn->sfd, buf, nbyte)) < 0) {
if (errno == EINTR)
continue;
if (errno != EAGAIN && errno != EWOULDBLOCK)
return -1;
if (!(conn->events & EPOLLIN)) {
conn->events = EPOLLIN;
if (conet_mod_conn(conn, conn->events) < 0)
return -1;
}
if (conet_yield(conn) < 0)
return -1;
}
return n;
}
I use EPOLLET and, you don't change the interest set until you actually
get an EAGAIN. *Many* read/write mode changes in the usage will simply
happen w/out an epoll_ctl() needed. The conet_mod_conn() function does the
actual epoll_ctl() and add EPOLLET to the specified event set. The
conet_yield() function end up calling the libpcl's co_resume(), that is
basically a switch-to-next-coroutine-until-fd-becomes-ready (maps
directly to a swapcontext).
That cuts 50+% of the epoll_ctl(EPOLL_CTL_MOD).
- Davide
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists