Re: mmotm 2009-02-14-00-49 uploaded -epoll busted.

From: Davide Libenzi
Date: Tue Feb 17 2009 - 13:31:20 EST


On Tue, 17 Feb 2009, Valdis.Kletnieks@xxxxxx wrote:

> On Sat, 14 Feb 2009 00:51:41 PST, akpm@xxxxxxxxxxxxxxxxxxxx said:
> > The mm-of-the-moment snapshot 2009-02-14-00-49 has been uploaded to
>
> The epoll patch series breaks nscd in some odd way. After it's started
> in the /etc/rc* scripts, the rest of boot proceeds very slowly, smells like
> nscd calls are hitting timeouts. Boot time went from ~1 minute to ~10 mins.
>
> nscd is Fedora Rawhide nscd-2.9.90-3.x86_64, in case that matters...
>
> Also, the series isn't bisectable right where it matters most, complaining
> about implicit definitions of wake_up_nested...
>
> epoll-keyed-wakeups-v2-add-__wake_up_locked_key-and-__wake_up_sync_key.patch
> epoll-keyed-wakeups-v2-introduce-new-_poll-wakeup-macros.patch GOOD
> epoll-keyed-wakeups-v3-introduce-new-_poll-wakeup-macros.patch BISECT BUSTED
> epoll-keyed-wakeups-v2-make-sockets-use-keyed-wakeups.patch
> epoll-keyed-wakeups-v2-teach-epoll-about-hints-coming-with-the-wakeup-key.patch
> epoll-keyed-wakeups-v2-teach-epoll-about-hints-coming-with-the-wakeup-key-update.patch BAD

Alright, I took a peek at nscd and noticed it waits only for RDNORM.
Inside the socket code, the full flags computation is performed inside the
poll function, and ATM socket code has simple signaling of IN/OUT/ERR. We
could changethe socket code to allow more fine grained event signaling,
but IMO is not worth it. Epoll ends up calling the device poll anyway, and
since this is an optimization patch, a simple change to post a full IN/OUT
mask is enough.
Andrew, the patch below replaced the one you have under the name:

epoll-keyed-wakeups-v2-make-sockets-use-keyed-wakeups.patch



Signed-off-by: Davide Libenzi <davidel@xxxxxxxxxxxxxxx>


- Davide


---
net/core/sock.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

Index: linux-2.6.mod/net/core/sock.c
===================================================================
--- linux-2.6.mod.orig/net/core/sock.c 2009-02-17 10:14:56.000000000 -0800
+++ linux-2.6.mod/net/core/sock.c 2009-02-17 10:21:43.000000000 -0800
@@ -1630,7 +1630,7 @@ static void sock_def_error_report(struct
{
read_lock(&sk->sk_callback_lock);
if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
- wake_up_interruptible(sk->sk_sleep);
+ wake_up_interruptible_poll(sk->sk_sleep, POLLERR);
sk_wake_async(sk, SOCK_WAKE_IO, POLL_ERR);
read_unlock(&sk->sk_callback_lock);
}
@@ -1639,7 +1639,8 @@ static void sock_def_readable(struct soc
{
read_lock(&sk->sk_callback_lock);
if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
- wake_up_interruptible_sync(sk->sk_sleep);
+ wake_up_interruptible_sync_poll(sk->sk_sleep, POLLIN |
+ POLLRDNORM | POLLRDBAND);
sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN);
read_unlock(&sk->sk_callback_lock);
}
@@ -1653,7 +1654,8 @@ static void sock_def_write_space(struct
*/
if ((atomic_read(&sk->sk_wmem_alloc) << 1) <= sk->sk_sndbuf) {
if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
- wake_up_interruptible_sync(sk->sk_sleep);
+ wake_up_interruptible_sync_poll(sk->sk_sleep, POLLOUT |
+ POLLWRNORM | POLLWRBAND);

/* Should agree with poll, otherwise some programs break */
if (sock_writeable(sk))
--
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/