This is really just due to bad coding in 'poll', or more precisely very bad
for this case. For example, why is it allocating a wait queue buffer if the
odds that it will need to wait are basically zero? Why is it adding file
descriptors to the wait queue before it has determined that it needs to
wait?
As load increases, more and more calls to 'poll' require no waiting. Yet
'poll' is heavily optimized for the 'no or low load' case. That's why 'poll'
doesn't scale on Linux.
> Yes, of course. The time spent inside poll/select becomes a PITA when you
> start dealing with huge number of fds. And this is kernel time. This does
> not obviously mean that if epoll is 10 times faster than poll under load,
> and you switch your app on epoll, it'll be ten times faster. It means that
> the kernel time spent inside poll will be 1/10. And many of the operations
> done by poll require IRQ locks and this increase the time the kernel
> spend with disabled IRQs, that is never a good thing.
My experience has been that this is a huge problem with Linux but not with
any other OS. It can be solved in user-space with some other penalities by
an adaptive sleep before each call to 'poll' and polling with a zero timeout
(thus avoiding the wait queue pain). But all the deficiencies in the 'poll'
implementation in the world won't show anything except that 'poll' is badly
implemented.
> - Davide
DS
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/