Re: poll() in 2.6 and beyond

From: Linus Torvalds
Date: Wed Mar 03 2004 - 18:10:02 EST




On Wed, 3 Mar 2004, Richard B. Johnson wrote:
>
> And YES! If I clear the flag only after it is read. It "fixes" the
> observed problem!

Ok. That solves one problem, but it does seem to point to the fact that
2.6.x calls down to poll() more than 2.4.x does.

It really _is_ normal to have multiple calls to "poll()" for the same fd
as a result of a single "poll()" system call, but if we actually get a
positive hit (ie the ->poll() call returns a bit that we consider to be a
success by comparing it to what we _wanted_ to see), then we should have
stopped doing that.

And since your test program always sets "POLLIN", any ->poll() call that
has the POLLIN flag set should have ended up being the last one (since it
would have marked a "success").

So there's still something I don't understand, and that seems to differ
between 2.4.x and 2.6.x. Can anybody else see it?

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