From: Davide Libenzi <davidel@xmailserver.org>
To: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Unexpected cascaded epoll behavior - my mistake or kernel bug
Date: Thu, 22 Jan 2009 17:21:46 -0800 (PST) [thread overview]
Message-ID: <alpine.DEB.1.10.0901221711500.7789@alien.or.mcafeemobile.com> (raw)
In-Reply-To: <200901230109.55706.pisa@cmp.felk.cvut.cz>
On Fri, 23 Jan 2009, Pavel Pisa wrote:
> Hello Davide and all others,
>
> I have got to implementing yet another event library and I experience
> something strange when level triggered epoll_wait() monitors another
> level triggered epoll set. Top level epoll_wait() return information
> about one event pending. The event points correctly to the monitored
> second level epoll fd, but epoll_wait() on this fd with 0 or small timeout
> returns zero/no events and top level epoll reporting is not reset at this
> point so program enters busy loop. If there are events, they are processed
> correctly.
I'm ashamed to say, I know. It has been reported to me about three months
ago, I coded patches, but I did not have the time to test them carefully.
The problem is that inside the epoll wakeup callback, we don't know which
even we got (and we can't call ->poll()). So we add the fd to the
ready-list and we wake up the waiters. The current code simply does return
EPOLLIN (from epoll's poll()) if the ready-list is not empty. The problem
is that the even we received in the epoll callback could have been a
POLLIN when the fd is waiting for POLLOUT. THis situations gets sorted out
in epoll_wait(), but inside epoll's poll() only a quick test was used
(ready-list not empty).
The patch was not exactly a one-liner, so I need a few days to double
check it and test it. I'll try to do it this w/end.
- Davide
next prev parent reply other threads:[~2009-01-23 1:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-23 0:09 Pavel Pisa
2009-01-23 1:21 ` Davide Libenzi [this message]
2009-01-24 21:58 ` Davide Libenzi
2009-01-25 21:02 ` Davide Libenzi
2009-01-26 1:28 ` Pavel Pisa
2009-01-26 19:54 ` Davide Libenzi
2009-01-26 20:36 ` Davide Libenzi
2009-01-26 21:04 ` Davide Libenzi
2009-01-27 0:24 ` Pavel Pisa
2009-01-27 1:03 ` Davide Libenzi
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=alpine.DEB.1.10.0901221711500.7789@alien.or.mcafeemobile.com \
--to=davidel@xmailserver.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pisa@cmp.felk.cvut.cz \
/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®