Re: [patch 1/2] epoll fix own poll()

From: Davide Libenzi
Date: Thu Jan 29 2009 - 21:52:28 EST


On Fri, 30 Jan 2009, Pavel Pisa wrote:

> So if there exists applications using epoll, they could waste sometimes
> most of CPU time without without any visible error indication.
> The most critical problem is, that even epoll_wait() on epoll set, which
> reports falsely ready condition, doe not clear that state for outer
> loop and event waiting mechanism. So in theory, some patch with
> smaller scale and impact which only ensures, that event is not falsely
> reported even after epoll_wait() call would be enough to save system
> from busyloop load. The false wakeup and wasted call to epoll_wait ()
> with no event returned is not so big problem.
>
> On the other hand, most of today applications are based on GLIB (poll),
> Qt (for pure Qt select) or libevent (not cascaded poll/epoll), which all are
> not prone to this problem. Even for my intended use, my code can
> work without cascading and if cascading is required, then standard
> poll and then moving of events triggers into GLIB loop is enough
> for 10 to 100 FDs. So actual real severity is not so high.
>
> I am happy that Davide has found fix to the problem, but even if the
> fix gets into 2.6.29 there would be older kernels for years there
> and use of epoll cascading would be problem. So I see as most
> important, that information about problem is known and does not
> surprise others. It would be great, if there is found safe way,
> how to ensure even without fix to revive from ill situation
> by some userspace action on older kernels.
> I do not see yet, why call to epoll_wait() does not to clean
> "rdllist" on unpatched kernel.

Epoll cleans, even on older kernels, the rdllist from spurious events,
upon epoll_wait(). If later on you get another spurious event, you fall
into the same condition. Or, can you send a minimal code snippet that
shows this not being true for older kernels?


- Davide


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