From: Rik van Riel <riel@redhat.com>
To: John Stultz <john.stultz@linaro.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Robert Love <rlove@google.com>,
Christoph Hellwig <hch@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Hugh Dickins <hughd@google.com>, Mel Gorman <mel@csn.ul.ie>,
Dave Hansen <dave@linux.vnet.ibm.com>,
Eric Anholt <eric@anholt.net>,
Jesse Barnes <jbarnes@virtuousgeek.org>,
Johannes Weiner <jweiner@redhat.com>,
Jon Masters <jcm@redhat.com>
Subject: Re: [PATCH] [RFC] fadvise: Add _VOLATILE,_ISVOLATILE, and _NONVOLATILE flags
Date: Tue, 22 Nov 2011 05:45:28 -0500 [thread overview]
Message-ID: <4ECB7D48.6080307@redhat.com> (raw)
In-Reply-To: <4ECB6D60.1010702@redhat.com>
On 11/22/2011 04:37 AM, Rik van Riel wrote:
> On 11/21/2011 10:33 PM, John Stultz wrote:
>> This patch provides new fadvise flags that can be used to mark
>> file pages as volatile, which will allow it to be discarded if the
>> kernel wants to reclaim memory.
>>
>> This is useful for userspace to allocate things like caches, and lets
>> the kernel destructively (but safely) reclaim them when there's memory
>> pressure.
>>
>> Right now, we can simply throw away pages if they are clean (backed
>> by a current on-disk copy). That only happens for anonymous/tmpfs/shmfs
>> pages when they're swapped out. This patch lets userspace select
>> dirty pages which can be simply thrown away instead of writing them
>> to disk first. See the mm/shmem.c for this bit of code. It's
>> different from FADV_DONTNEED since the pages are not immediately
>> discarded; they are only discarded under pressure.
>
> I've got a few questions:
>
> 1) How do you tell userspace some of its data got
> discarded?
>
> 2) How do you prevent the situation where every
> volatile object gets a few pages discarded, making
> them all unusable?
> (better to throw away an entire object at once)
>
> 3) Isn't it too slow for something like Firefox to
> create a new tmpfs object for every single throw-away
> cache object?
Oh, and a fourth issue with the _VOLATILE approach, which
I forgot to write down before:
4) Virtualization. Marking an object (and its pages)
_VOLATILE inside a guest will not be visible on the
host side, which means a virtual system may continue
to suffer the performance penalty anyway.
On the other hand, the approach I outlined will simply result
in a virtual machine being asked to reduce its memory, and
possibly later on passing that notification on to the programs
running inside. In other words, the "please shrink your caches"
notification naturally recurses into cgroups and virtual machines.
next prev parent reply other threads:[~2011-11-22 10:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-22 3:33 [PATCH] [RFC] fadvise: Add _VOLATILE,_ISVOLATILE, and _NONVOLATILE flags John Stultz
2011-11-22 9:37 ` Rik van Riel
2011-11-22 10:45 ` Rik van Riel [this message]
2011-11-22 20:39 ` Dave Hansen
2011-11-22 16:31 ` Robert Love
2011-11-22 19:48 ` John Stultz
2011-11-23 0:27 ` Rik van Riel
[not found] ` <CAG6tG3xTkW1J=6xmUmmJoswJyR6ii5RDXvAsYrcH0CkVuUmJrQ@mail.gmail.com>
2011-11-23 0:39 ` Rik van Riel
2011-11-23 15:52 ` Robert Love
2011-11-26 0:05 ` Jan Kara
2011-11-22 20:52 ` Andrew Morton
2011-11-22 21:32 ` John Stultz
2011-11-22 21:39 ` Andrew Morton
2011-11-22 22:58 ` John Stultz
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=4ECB7D48.6080307@redhat.com \
--to=riel@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dave@linux.vnet.ibm.com \
--cc=eric@anholt.net \
--cc=hch@infradead.org \
--cc=hughd@google.com \
--cc=jbarnes@virtuousgeek.org \
--cc=jcm@redhat.com \
--cc=john.stultz@linaro.org \
--cc=jweiner@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mel@csn.ul.ie \
--cc=rlove@google.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