Re: [PATCH] mm: implement POSIX_FADV_NOREUSE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Why don't you use POSIX_FADV_DONTNEED when you no longer use those
> pages? E.g. on close()?

Because DONTNEED throws out the pages even if other processes use them
as well, so additional hacks are needed to prevent that (see for
example[1]).

> This also looks to ignore the reuse flag for existing pages.  Have you
> thought about what the semantics should be there?

The idea is to only treat the pages special when they are first read
from disk. This way we achieve the main goal of not displacing useful
cache content.

> Also, *should* readahead pages really have this flag set?  If a very
> important page gets brought in via readahead, doesn't this put it at a
> disadvantage for getting aged out?

If the flag is not set on readahead pages, the advise barely has any
effect at all, since most of the file gets read through readahead. Of
course that very important page has a disadvantage at the beginning, but
as soon as it has been moved into the active list the NOREUSE doesn't
affect it anymore. Worst case it gets read once more without the flag.

On Tue, 2014-03-11 at 14:27 -0700, Andrew Morton wrote:
> And it sets PG_noreuse on new pages whether or not they were within the
> fadvise range (offset...offset+len).  It's not really an fadvise
> operation at all.

NORMAL, SEQUENTIAL and RANDOM don't honor the range either. So we
figured it would be ok to do so for the sake of keeping the
implementation simple.

> > page flags are really scarce and I am not sure this is the best
> usage of
> > the few remaining slots.
> 
> Yeah, especially since the use so so transient.  I can see why using a
> flag is nice for a quick prototype, but this is a far cry from needing
> one. :)  You might be able to reuse a bit like PageReadahead.  You
> could
> probably also use a bit in the page pointer of the lruvec, or even
> have
> a percpu variable that stores a pointer to the 'struct page' you want
> to
> mark as NOREUSE.

Ok, we understand that we can't add a page flag. We tried to find a flag
to recycle but did not succeed. lruvec doesn't have page pointers and we
don't have access to a pagevec and the file struct at the same time. We
don't really understand the last suggestion, as we need to save this
information for more than one page and going over a list every time we
add something to an lru list doesn't seem like a good idea.

Would it be acceptable to add a member to struct page for our purpose?

---

[1] http://insights.oetiker.ch/linux/fadvise.html

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]