Re: File hinting, and a new file flag?

Stephen C. Tweedie (sct@redhat.com)
Thu, 15 Jul 1999 12:22:17 +0100 (BST)


Hi,

On Wed, 14 Jul 1999 08:07:46 -0400, "Lou Grinzo" <lgrinzo@stny.lrun.com>
said:

> The recent discussion about hinting and speculative execution
> brought to mind something I've long wondered about: Why is
> there no way to specify on a file open that you will be reading
> an entire file sequentially?

Posix has a new posix_fadvise function for this, and Unix mmap()s
usually support madvise() for the same functionality.

> If the OS knew about the caller's intentions at open time, it could
> check the available memory and the file's size, and if the ratio were
> high enough, it could read the whole file into a buffer, or even run a
> background thread to do read aheads.

We already do the background readaheads. The trouble is, even knowing
the expected access pattern, you have no idea how fast the application
is going to request the data, how many other demands on system memory
are going to be made in the mean time and so on. The current behaviour,
which detects sequential reads automatically and which expands the
readahead buffer to 100 or 200k dynamically, works well and doesn't
result in a huge amount of wasted IO or memory.

--Stephen

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/