linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Senger <lukas@fridolin.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>,
	Michal Hocko <mhocko@suse.cz>,
	Matthias Wirth <matthias.wirth@gmail.com>,
	Matthew Wilcox <matthew@wil.cx>, Jeff Layton <jlayton@redhat.com>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Rik van Riel <riel@redhat.com>, Lisa Du <cldu@marvell.com>,
	Paul Mackerras <paulus@samba.org>,
	Sasha Levin <sasha.levin@oracle.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Fengguang Wu <fengguang.wu@intel.com>,
	Shaohua Li <shli@kernel.org>,
	Alexey Kardashevskiy <aik@ozlabs.ru>,
	Minchan Kim <minchan@kernel.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Steven Whitehouse <swhiteho@redhat.com>,
	Mel Gorman <mgorman@suse.de>,
	Cody P Schafer <cody@linux.vnet.ibm.com>,
	Jiang Liu <liuj97@gmail.com>,
	David Rientjes <rientjes@google.com>,
	"Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>,
	Zhang Yanfei <zhangyanfei@cn.fujitsu.com>,
	Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>,
	Lukas Czerner <lczerner@redhat.com>,
	Damien Ramonda <damien.ramonda@intel.com>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, i4passt <i4passt@lists.cs.fau.de>
Subject: Re: [PATCH] mm: implement POSIX_FADV_NOREUSE
Date: Wed, 12 Mar 2014 12:59:52 +0100	[thread overview]
Message-ID: <1394625592.543.52.camel@dinghy> (raw)
In-Reply-To: <20140311142729.1e3e4e51186db4c8ee49a9f4@linux-foundation.org>

> 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@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2014-03-12 12:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-11 10:25 [PATCH] mm: implement POSIX_FADV_NOREUSE Matthias Wirth
2014-03-11 14:06 ` Michal Hocko
2014-03-11 15:24   ` Dave Hansen
2014-03-11 21:27     ` Andrew Morton
2014-03-12 11:59       ` Lukas Senger [this message]
2014-03-12 14:46         ` Michal Hocko
2014-03-12 16:05         ` Dave Hansen
2014-03-13 12:40           ` Lukas Senger
2014-03-13 18:43 ` [PATCHv2] " Matthias Wirth
2014-03-13 20:01   ` Andrew Morton
2014-03-14 12:34     ` Lukas Senger
2014-03-14 15:52 ` [PATCHv3] " Matthias Wirth
2014-03-18 15:14   ` Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1394625592.543.52.camel@dinghy \
    --to=lukas@fridolin.com \
    --cc=aik@ozlabs.ru \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=bfields@fieldses.org \
    --cc=cldu@marvell.com \
    --cc=cody@linux.vnet.ibm.com \
    --cc=damien.ramonda@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=fengguang.wu@intel.com \
    --cc=hannes@cmpxchg.org \
    --cc=i4passt@lists.cs.fau.de \
    --cc=jlayton@redhat.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=lczerner@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liuj97@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=matthew@wil.cx \
    --cc=matthias.wirth@gmail.com \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.cz \
    --cc=minchan@kernel.org \
    --cc=paulus@samba.org \
    --cc=raghavendra.kt@linux.vnet.ibm.com \
    --cc=riel@redhat.com \
    --cc=rientjes@google.com \
    --cc=sasha.levin@oracle.com \
    --cc=shli@kernel.org \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=swhiteho@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=zhangyanfei@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).