Re: [PATCH v3 0/3] epoll: introduce round robin wakeup mode

From: Jonathan Corbet
Date: Fri Feb 27 2015 - 16:31:55 EST


On Fri, 27 Feb 2015 13:10:34 -0800
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:

> I don't really understand the need for rotation/round-robin. We can
> solve the thundering herd via exclusive wakeups, but what is the point
> in choosing to wake the task which has been sleeping for the longest
> time? Why is that better than waking the task which has been sleeping
> for the *least* time? That's probably faster as that task's data is
> more likely to still be in cache.

So here's my chance to show the world what a fool I am (again)... If I
understand this at all, a task woken from epoll_wait() remains on the wait
queues while it is off doing other stuff. If you're doing exclusive
wakeups, the task at the head of the queue will get all of them, since it
never gets removed from the queue. So you don't spread your load around,
and, indeed, you may "wake" a process that is busy doing something else and
can't deal with the event now anyway. You need some way to shuffle up the
wait queue, and round-robin is probably as good as any.

(The alternative would be to take the process off the queue until it calls
epoll_wait() again, but that runs counter to what epoll is all about).

At least, that was my impression when I took a look at this stuff.

jon
--
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/