Re: [patch rfc] towards supporting O_NONBLOCK on regular files

From: Alexandre Oliva
Date: Sun Oct 17 2004 - 14:45:15 EST


On Oct 17, 2004, Ingo Molnar <mingo@xxxxxxxxxx> wrote:

> I.e. the readahead-kicking is necessary after all, because
> squid apparently assumes that re-trying a read will eventually succeed.

I'm not sure it assumes that. It definitely expects read to succeed
if poll says there is data available from the file, though, and having
poll return that there is data, and then having read fail because
there isn't anything there, so that you go back to poll, is a recipe
for wasting CPU. I do think read should kick in readahead, yes, but
so should poll, if the process says it wants to read from the file,
and poll should not return (or not say data is available) unless an
immediate, atomic call to read would actually return some data. Of
course, if the data happens to be elicited from memory between the
poll and read calls, it's legitimate for read to fail with -EAGAIN,
but this shouldn't happen very often.

--
Alexandre Oliva http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}
-
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/