linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrea Righi <andrea@betterlinux.com>
To: "Pádraig Brady" <P@draigBrady.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	akpm@linux-foundation.org, minchan.kim@gmail.com,
	riel@redhat.com, peterz@infradead.org, hannes@cmpxchg.org,
	kamezawa.hiroyu@jp.fujitsu.com, aarcange@redhat.com,
	hughd@google.com, jamesjer@betterlinux.com, marcus@bluehost.com,
	matt@bluehost.com, tytso@mit.edu, shaohua.li@intel.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 0/2] fadvise: support POSIX_FADV_NOREUSE
Date: Mon, 27 Jun 2011 14:39:46 +0200	[thread overview]
Message-ID: <20110627123946.GB1658@thinkpad> (raw)
In-Reply-To: <4E086F51.50403@draigBrady.com>

On Mon, Jun 27, 2011 at 12:53:53PM +0100, Padraig Brady wrote:
> On 27/06/11 11:29, Andrea Righi wrote:
> > The actual problem I think is that apps expect that DONTNEED can be used
> > to drop cache, but this is not written anywhere in the POSIX standard.
> > 
> > I would also like to have both functionalities: 1) be sure to drop page
> > cache pages (now there's only a system-wide knob to do this:
> > /proc/sys/vm/drop_caches), 2) give an advice to the kernel that I will
> > not reuse some pages in the future.
> > 
> > The standard can only provide 2). If we also want 1) at the file
> > granularity, I think we'd need to introduce something linux specific to
> > avoid having portability problems.
> 
> True, though Linux is the reference for posix_fadvise() implementations,
> given its lack of support on other platforms.
> 
> So just to summarize for _my_ reference.
> You're changing DONTNEED to mean "drop if !PageActive()".
> I.E. according to http://linux-mm.org/PageReplacementDesign
> "drop if files only accessed once".

Drop if pages were only accessed once, they're not mapped by any other
process and they're not unevictable.

> 
> This will mean that there is no way currently to
> remove a particular file from the cache on linux.

Correct. There's not a way to do this for a single file (except running
POSIX_FADV_DONTNEED twice...).

> Hopefully that won't affect any of:
> http://codesearch.google.com/#search/&q=POSIX_FADV_DONTNEED
> 
> Ideally I'd like cache functions for:
>  DROP, ADD, ADD if space1
> which could correspond to:
>  DONTNEED, WILLNEED, NOREUSE
> but what we're going for are these somewhat overlapping functions:
>  DROP if used once2, ADD, ADD if space

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).

-Andrea

> 
> cheers,
> Padraig.
> 
> 1 Not implemented yet.
> 
> 2 Hopefully there are no access patterns a single
> process can do to make a PageActive as that would
> probably not be desired in relation to "Drop if used once"
> functionality.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2011-06-27 12:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-24 13:49 [PATCH v3 0/2] fadvise: support POSIX_FADV_NOREUSE Andrea Righi
2011-06-24 13:49 ` [PATCH v3 1/2] mm: introduce __invalidate_mapping_pages() Andrea Righi
2011-06-26 22:46   ` Rik van Riel
2011-06-27  7:05     ` Andrea Righi
2011-06-24 13:49 ` [PATCH v3 2/2] fadvise: implement POSIX_FADV_NOREUSE Andrea Righi
2011-06-26 22:47   ` Rik van Riel
2011-06-27  7:05     ` Andrea Righi
2011-06-27  3:04 ` [PATCH v3 0/2] fadvise: support POSIX_FADV_NOREUSE KOSAKI Motohiro
2011-06-27  7:11   ` Andrea Righi
2011-06-27  7:42     ` KOSAKI Motohiro
2011-06-27 10:17     ` Pádraig Brady
2011-06-27 10:29       ` Andrea Righi
2011-06-27 11:53         ` Pádraig Brady
2011-06-27 12:39           ` Andrea Righi [this message]

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=20110627123946.GB1658@thinkpad \
    --to=andrea@betterlinux.com \
    --cc=P@draigBrady.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=jamesjer@betterlinux.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=marcus@bluehost.com \
    --cc=matt@bluehost.com \
    --cc=minchan.kim@gmail.com \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=shaohua.li@intel.com \
    --cc=tytso@mit.edu \
    /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).