From: Miklos Szeredi <miklos@szeredi.hu>
To: Michal Hocko <mhocko@kernel.org>
Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org,
"Darrick J. Wong" <darrick.wong@oracle.com>
Subject: Re: sharing page cache pages between multiple mappings
Date: Thu, 19 May 2016 12:17:14 +0200 [thread overview]
Message-ID: <CAJfpegvqPrP=AtaOSwMX1s=-oVAEE97NMwEHUkg93dBWvOykHw@mail.gmail.com> (raw)
In-Reply-To: <20160519090521.GA26114@dhcp22.suse.cz>
On Thu, May 19, 2016 at 11:05 AM, Michal Hocko <mhocko@kernel.org> wrote:
> On Thu 19-05-16 10:20:13, Miklos Szeredi wrote:
>> Has anyone thought about sharing pages between multiple files?
>>
>> The obvious application is for COW filesytems where there are
>> logically distinct files that physically share data and could easily
>> share the cache as well if there was infrastructure for it.
>
> FYI this has been discussed at LSFMM this year[1]. I wasn't at the
> session so cannot tell you any details but the LWN article covers it at
> least briefly.
Cool, so it's not such a crazy idea.
Darrick, would you mind briefly sharing your ideas regarding this?
The use case I have is fixing overlayfs weird behavior. The following
may result in "buf" not matching "data":
int fr = open("foo", O_RDONLY);
int fw = open("foo", O_RDWR);
write(fw, data, sizeof(data));
read(fr, buf, sizeof(data));
The reason is that "foo" is on a read-only layer, and opening it for
read-write triggers copy-up into a read-write layer. However the old,
read-only open still refers to the unmodified file.
Fixing this properly requires that when opening a file, we don't
delegate operations fully to the underlying file, but rather allow
sharing of pages from underlying file until the file is copied up. At
that point we switch to sharing pages with the read-write copy.
Another use case is direct access in fuse: people often want I/O
operations on a fuse file to go directly to an underlying file. Doing
this properly requires sharing pages between the real, underlying file
and the fuse file.
Thanks,
Miklos
next prev parent reply other threads:[~2016-05-19 10:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-19 8:20 sharing page cache pages between multiple mappings Miklos Szeredi
2016-05-19 9:05 ` Michal Hocko
2016-05-19 10:17 ` Miklos Szeredi [this message]
2016-05-19 10:53 ` Michal Hocko
2016-05-19 23:48 ` Dave Chinner
2016-05-20 10:37 ` Miklos Szeredi
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='CAJfpegvqPrP=AtaOSwMX1s=-oVAEE97NMwEHUkg93dBWvOykHw@mail.gmail.com' \
--to=miklos@szeredi.hu \
--cc=darrick.wong@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
/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).