Re: [PATCH v3 0/2] fadvise: support POSIX_FADV_NOREUSE

From: Andrea Righi
Date: Tue Jul 12 2011 - 18:32:37 EST


On Tue, Jul 12, 2011 at 02:52:49PM -0700, Patrick J. LoPresti wrote:
>
> > IIUC, NOREUSE means "the application will use this range of the file
> > once". It's something that we do _before_ accessing the file. And the
> > kernel needs to remember the ranges of NOREUSE data for each file, so
> > that page cache can be immediately dropped after the data has been
> > accessed (if possible).
>
> I am no expert on the Linux page cache, but my applications have a great
> interest in exercising some control over it...
>
> Could NOREUSE be as simple as setting a bit on the page that means
> "never mark this page active"?
>
> Or more conservatively, "clear this bit before marking the page active"?
>
> So POSIX_FADV_NOREUSE would set the bit on the page. Then any operation
> that would normally mark the page active would instead merely clear the
> bit. This would keep the page on the inactive list _after_ the first
> read and allow it to be reclaimed, which is at least in the "spirit" of
> NOREUSE.

If the file data is not in memory you can't set a bit in any struct
page. You could even open a file and execute POSIX_FADV_NOREUSE without
reading any page from the file.

I think it would be better to maintain a list of file offset/length
structures per file descriptor or (as a starting solution) even mark the
entire file as non-cacheable without considering the ranges.

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