From: John Stultz <john.stultz@linaro.org>
To: Dmitry Adamushko <dmitry.adamushko@gmail.com>
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Android Kernel Team <kernel-team@android.com>,
Robert Love <rlove@google.com>, Mel Gorman <mel@csn.ul.ie>,
Hugh Dickins <hughd@google.com>,
Dave Hansen <dave@linux.vnet.ibm.com>,
Rik van Riel <riel@redhat.com>,
Dave Chinner <david@fromorbit.com>, Neil Brown <neilb@suse.de>,
Andrea Righi <andrea@betterlinux.com>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Subject: Re: [PATCH 0/2] [RFC] Volatile Ranges (v6)
Date: Mon, 09 Apr 2012 10:56:39 -0700 [thread overview]
Message-ID: <4F8322D7.6080704@linaro.org> (raw)
In-Reply-To: <CAO6Zf6C618gt4uLaw=MYgAq519d3UrW7zLf78Q1HOryxzRpkKA@mail.gmail.com>
On 04/07/2012 01:14 AM, Dmitry Adamushko wrote:
> On 7 April 2012 02:08, John Stultz<john.stultz@linaro.org> wrote:
>> Another detail is that by hanging the volatile ranges off of the
>> address_space, the volatility for tmpfs files persists even when no one
>> has an open fd on the file. This could cause some surprises if application
>> A marked some pages volatile and died, then application B opened the file
>> and had pages dropped out underneith it while it was being used. I suspect
>> I need to clean up the volatility when all fds are dropped.
> And how do you handle the regions that have already been purged by
> this moment? Unless B has some specific mechanism to verify the
> consistency of the content, a sensible way would be to always mark off
> the regions as non-volatile before accessing them and verify the
> return code to see if there are holes.
>
> More generally, what if B opens the file while A is still working with
> it? Besides the use of normal synchronization mechanisms, B should not
> make any assumption on the current state of the regions (unless there
> is a high-level protocol between A and B to share this info). So an
> explicit mark-off-as-non_volatile could be a simple generic mechanism.
>
So yes, marking as non-volatile before you use pages would be a way to
avoid the issue. But it still rubs me the wrong way.
I think the main issue I have with it is that it makes volatility the
assumed state. So unless you mark it non-volatile to begin with, the
file could be volatile somewhere. I feel like volatility should be the
special state, not the assumed one, so normal applications that don't
think about volatility are less-likely to be surprised.
Now, when you have concurrent users of a file, you have to coordinate,
and things can change under you. That's an expectation people already
have. But if volatile ranges persist, its sort of introducing a form of
concurrency to non-concurrent access. Where a killed application can
reach from the grave and zap a page in file someone else is using. I
think this is too unexpected.
The case that bit me in particular was in testing this patch, I had an
application (call it A) that had a bug and was marking a larger range
volatile then it re-set to non-volatile. Then when using the same file
later with a different test application (call it B), I was seeing those
further pages be zapped unexpectedly. It took me a while to realize
that it wasn't a problem with the B application, or the patch itself,
but was a persistent range that was set much earlier by A.
So I suspect it would be better if the volatile ranges should be
something that are cleared out when the last fd is closed.
thanks
-john
prev parent reply other threads:[~2012-04-09 17:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-07 0:08 [PATCH 0/2] [RFC] Volatile Ranges (v6) John Stultz
2012-04-07 0:08 ` [PATCH 1/2] [RFC] Range tree implementation John Stultz
2012-04-07 17:36 ` Sasha Levin
2012-04-09 18:04 ` John Stultz
2012-04-09 18:44 ` Sasha Levin
2012-04-07 0:08 ` [PATCH 2/2] [RFC] fadvise: Add _VOLATILE,_ISVOLATILE, and _NONVOLATILE flags John Stultz
2012-04-07 8:14 ` [PATCH 0/2] [RFC] Volatile Ranges (v6) Dmitry Adamushko
2012-04-09 17:56 ` John Stultz [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=4F8322D7.6080704@linaro.org \
--to=john.stultz@linaro.org \
--cc=akpm@linux-foundation.org \
--cc=andrea@betterlinux.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=dave@linux.vnet.ibm.com \
--cc=david@fromorbit.com \
--cc=dmitry.adamushko@gmail.com \
--cc=hughd@google.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mel@csn.ul.ie \
--cc=neilb@suse.de \
--cc=riel@redhat.com \
--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;
as well as URLs for NNTP newsgroup(s).