Re: [PATCH] rfc: threaded epoll_wait thundering herd

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ulrich Drepper
Date: Monday, May 7, 2007 - 2:00 pm

On 5/5/07, Davi Arnaut <davi@haxent.com.br> wrote:

There is a huge problem with this approach and we're back at the
inadequate interface.

select/poll/epoll are thread cancellation points.  I.e., the thread
can be canceled before returning to the user.  If this cancellation
happens between the kernel deciding to give this thread the event (and
no other thread) and the thread testing for cancellation in the libc
wrapper around the syscall, then the event is lost and the process(es)
might hang.

With kevent we in the end fixed the problem by requiring that part of
the cancellation handling the thread tries to wake up another thread
waiting for the event queue.  This is easily possible since the event
data is in the shared memory segment and it's just purely the thread
wakeup that is needed.

To make something like this work for poll you'd have to push back the
revents fields of the result back to the kernel which might then cause
another thread to be woken up.  I find this too ugly to consider.  You
guys will not believe this but I really thought all these things
through before writing the OLS paper.  poll cannot be salvaged.


There is another thing about this selective wakeup: do I assume it
correctly that if more than one file descriptor is reported ready more
than one thread is woken?  I think nothing else can be justified.
Will in this case both threads get the same set of descriptors
reported or will they see disjunct sets?
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] rfc: threaded epoll_wait thundering herd, Davi Arnaut, (Fri May 4, 4:37 pm)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Eric Dumazet, (Fri May 4, 9:15 pm)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Linus Torvalds, (Fri May 4, 9:44 pm)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Eric Dumazet, (Fri May 4, 10:47 pm)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Davide Libenzi, (Sat May 5, 12:00 pm)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Davi Arnaut, (Sat May 5, 2:42 pm)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Chase Venters, (Mon May 7, 8:46 am)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Davide Libenzi, (Mon May 7, 10:18 am)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Chase Venters, (Mon May 7, 11:17 am)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Ulrich Drepper, (Mon May 7, 2:00 pm)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Davi Arnaut, (Mon May 7, 2:34 pm)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Ulrich Drepper, (Mon May 7, 3:19 pm)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Davide Libenzi, (Mon May 7, 3:35 pm)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Davide Libenzi, (Mon May 7, 3:47 pm)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Davi Arnaut, (Mon May 7, 4:15 pm)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Ulrich Drepper, (Mon May 7, 7:32 pm)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Ulrich Drepper, (Mon May 7, 7:49 pm)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Davi Arnaut, (Mon May 7, 8:24 pm)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Kyle Moffett, (Mon May 7, 8:56 pm)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Linus Torvalds, (Mon May 7, 9:35 pm)
Re: [PATCH] rfc: threaded epoll_wait thundering herd, Davide Libenzi, (Mon May 7, 11:30 pm)