From: "Paton J. Lewis" <palewis@adobe.com>
To: Christof Meerwald <cmeerw@cmeerw.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
Jason Baron <jbaron@redhat.com>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Paul Holland <pholland@adobe.com>,
Davide Libenzi <davidel@xmailserver.org>
Subject: Re: [PATCH] epoll: Improved support for multi-threaded clients
Date: Tue, 14 Aug 2012 15:13:55 -0700 [thread overview]
Message-ID: <6.2.5.6.2.20120814150529.04aace70@adobe.com> (raw)
In-Reply-To: <20120814202125.GH1407@edge.cmeerw.net>
At 8/14/2012 01:21 PM, Christof Meerwald wrote:
>Hi Paton,
>
>On Thu, Aug 02, 2012 at 06:37:06PM -0700, Paton J. Lewis wrote:
>[...]
> > My first concern is about code clarity. Using a custom event to
> > delete an event type (either EPOLLIN or EPOLLOUT) from an epoll item
> > requires that functionality to be split across two areas of code:
> > the code that requests the deletion (via the call to epoll_ctl), and
> > the code that responds to it (via epoll_wait).
>
>But don't you have a similar problem in your proposal as well as you
>might get an EBUSY when trying to disabling the item - in which case
>you would have to do the deletion in the epoll_wait loop.
Good point.
> > However, my main concern is about performance. Handling a custom
> > event means that each return from epoll_wait requires the responding
> > thread to check for possible custom events, which in the case of
> > deletion is going to be relatively rare. Thus code which was once
> > purely concerned with responding to I/O events must now spend a
> > fraction of its time testing for exceptional conditions. In
> > addition, handling deletion in this manner now requires a thread or
> > context switch.
>
>But in your initial proposal you also had the code checking for
>deletion in the epoll_wait loop.
Also true. However, I believe the context switch is always required
by the custom message passing technique, but will not always happen
when using the event disabling technique.
> > Given the drawbacks listed above, and the kernel design philosophy
> > of only implementing what is actually needed, I would argue for
> > sticking with the original EPOLL_CTL_DISABLE proposal for now.
>
>I have finally had some chance to play around with your patch a bit
>and I really think that you don't want to check for
>ep_is_linked(&epi->rdllink) in ep_disable as I don't see that this
>would provide any useful semantics with respect to race-conditions.
>I.e. consider the point in the epoll_wait loop just after you have
>re-enabled to item - in this case ep_disable would (almost certainly)
>return EBUSY, but there is no guarantee that epoll_wait will be woken
>up on the next iteration.
>
>As I mentioned, I think it would be much more useful to check for
>"epi->event.events & ~EP_PRIVATE_BITS" instead which I believe would
>provide more useful semantics.
You are correct. Thanks for being patient and persistent here. I
discovered this problem myself last week during testing, and I am
planning to post a v2 patch proposal that includes this fix.
I am also working on an epoll self-test as Andrew Morton suggested.
I'm going to finish that before re-submitting the EPOLL_CTL_DISABLE
patch to help reduce the possibility that the v2 patch still contains bugs.
Pat
>Christof
>
>--
>
>http://cmeerw.org sip:cmeerw at cmeerw.org
>mailto:cmeerw at cmeerw.org xmpp:cmeerw at cmeerw.org
prev parent reply other threads:[~2012-08-14 22:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-11 22:34 [PATCH] epoll: Improved support for multi-threaded clients Paton Lewis
2012-06-13 23:27 ` Andrew Morton
2012-06-18 21:58 ` Paton J. Lewis
2012-06-19 23:42 ` Andrew Morton
2012-06-16 18:47 ` Christof Meerwald
2012-06-18 23:24 ` Paton J. Lewis
2012-06-19 18:17 ` Christof Meerwald
2012-06-29 21:43 ` Paton J. Lewis
2012-07-09 18:45 ` Christof Meerwald
2012-08-03 1:37 ` Paton J. Lewis
2012-08-14 20:21 ` Christof Meerwald
2012-08-14 22:13 ` Paton J. Lewis [this message]
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=6.2.5.6.2.20120814150529.04aace70@adobe.com \
--to=palewis@adobe.com \
--cc=cmeerw@cmeerw.org \
--cc=davidel@xmailserver.org \
--cc=jbaron@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pholland@adobe.com \
--cc=viro@zeniv.linux.org.uk \
/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).