From: Hongbo Li <lihongbo22@huawei.com>
To: Gao Xiang <hsiangkao@linux.alibaba.com>, <chao@kernel.org>,
<brauner@kernel.org>
Cc: <djwong@kernel.org>, <amir73il@gmail.com>, <hch@lst.de>,
<linux-fsdevel@vger.kernel.org>, <linux-erofs@lists.ozlabs.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v15 5/9] erofs: introduce the page cache share feature
Date: Wed, 21 Jan 2026 09:29:25 +0800 [thread overview]
Message-ID: <45c45182-e0f3-4b69-869f-5a0a90d543f5@huawei.com> (raw)
In-Reply-To: <3ae9078a-ba5c-460d-89ea-8fdbdf190a10@linux.alibaba.com>
On 2026/1/20 22:19, Gao Xiang wrote:
>
>
> On 2026/1/16 17:55, Hongbo Li wrote:
>> From: Hongzhen Luo <hongzhen@linux.alibaba.com>
>>
>> Currently, reading files with different paths (or names) but the same
>> content will consume multiple copies of the page cache, even if the
>> content of these page caches is the same. For example, reading
>> identical files (e.g., *.so files) from two different minor versions of
>> container images will cost multiple copies of the same page cache,
>> since different containers have different mount points. Therefore,
>> sharing the page cache for files with the same content can save memory.
>>
>> This introduces the page cache share feature in erofs. It allocate a
>> deduplicated inode and use its page cache as shared. Reads for files
>> with identical content will ultimately be routed to the page cache of
>> the deduplicated inode. In this way, a single page cache satisfies
>> multiple read requests for different files with the same contents.
>>
>> We introduce inode_share mount option to enable the page sharing mode
>> during mounting.
>>
>> Signed-off-by: Hongzhen Luo <hongzhen@linux.alibaba.com>
>> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
>> ---
>> Documentation/filesystems/erofs.rst | 5 +
>> fs/erofs/Makefile | 1 +
>> fs/erofs/inode.c | 24 +----
>> fs/erofs/internal.h | 57 ++++++++++
>> fs/erofs/ishare.c | 161 ++++++++++++++++++++++++++++
>> fs/erofs/super.c | 56 +++++++++-
>> fs/erofs/xattr.c | 34 ++++++
>> fs/erofs/xattr.h | 3 +
>> 8 files changed, 316 insertions(+), 25 deletions(-)
>> create mode 100644 fs/erofs/ishare.c
>>
>> diff --git a/Documentation/filesystems/erofs.rst
>> b/Documentation/filesystems/erofs.rst
>> index 08194f194b94..27d3caa3c73c 100644
>> --- a/Documentation/filesystems/erofs.rst
>> +++ b/Documentation/filesystems/erofs.rst
>> @@ -128,7 +128,12 @@ device=%s Specify a path to an extra
>> device to be used together.
>> fsid=%s Specify a filesystem image ID for Fscache
>> back-end.
>> domain_id=%s Specify a domain ID in fscache mode so that
>> different images
>> with the same blobs under a given domain ID
>> can share storage.
>> + Also used for inode page sharing mode which
>> defines a sharing
>> + domain.
>
> I think either the existing or the page cache sharing
> here, `domain_id` should be protected as sensitive
> information, so it'd be helpful to protect it as a
> separate patch.
>
> And change the description as below:
> Specify a trusted domain ID for fscache mode
> so that
> different images with the same blobs,
> identified by blob IDs,
> can share storage within the same trusted
> domain.
> Also used for different filesystems with
> inode page sharing
> enabled to share page cache within the
> trusted domain.
>
>
>> fsoffset=%llu Specify block-aligned filesystem offset for
>> the primary device.
>> +inode_share Enable inode page sharing for this
>> filesystem. Inodes with
>> + identical content within the same domain ID
>> can share the
>> + page cache.
>> ===================
>> =========================================================
>
> ...
>
>
>> erofs_exit_shrinker();
>> @@ -1062,6 +1111,8 @@ static int erofs_show_options(struct seq_file
>> *seq, struct dentry *root)
>> seq_printf(seq, ",domain_id=%s", sbi->domain_id);
>
> I think we shouldn't show `domain_id` to the userspace
> entirely.
>
> Also, let's use kfree_sentitive() and no_free_ptr() to
> replace the following snippet:
>
> case Opt_domain_id:
> kfree(sbi->domain_id); -> kfree_sentitive
Ok, kfree_sensitive/no_free_ptr looks good, this way makes domain_id
more reliable.
Thanks,
Hongbo
> sbi->domain_id = kstrdup(param->string, GFP_KERNEL);
> -> sbi->domain_id = no_free_ptr(param->string);
> if (!sbi->domain_id)
> return -ENOMEM;
> break;
>
> And replace with kfree_sentitive() for domain_id everywhere.
>
> Thanks,
> Gao Xiang
next prev parent reply other threads:[~2026-01-21 1:29 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 9:55 [PATCH v15 0/9] erofs: Introduce page cache sharing feature Hongbo Li
2026-01-16 9:55 ` [PATCH v15 1/9] fs: Export alloc_empty_backing_file Hongbo Li
2026-01-16 9:55 ` [PATCH v15 2/9] erofs: decouple `struct erofs_anon_fs_type` Hongbo Li
2026-01-16 15:38 ` Christoph Hellwig
2026-01-19 1:34 ` Hongbo Li
2026-01-19 1:44 ` Gao Xiang
2026-01-19 2:23 ` Hongbo Li
2026-01-19 7:28 ` Christoph Hellwig
2026-01-16 9:55 ` [PATCH v15 3/9] erofs: support user-defined fingerprint name Hongbo Li
2026-01-16 9:55 ` [PATCH v15 4/9] erofs: support domain-specific page cache share Hongbo Li
2026-01-16 9:55 ` [PATCH v15 5/9] erofs: introduce the page cache share feature Hongbo Li
2026-01-16 15:46 ` Christoph Hellwig
2026-01-16 16:21 ` Gao Xiang
2026-01-19 7:29 ` Christoph Hellwig
2026-01-19 7:53 ` Gao Xiang
2026-01-19 8:12 ` Gao Xiang
2026-01-19 8:32 ` Christoph Hellwig
2026-01-19 8:52 ` Gao Xiang
2026-01-19 9:22 ` Christoph Hellwig
2026-01-19 9:38 ` Gao Xiang
2026-01-19 9:53 ` Gao Xiang
2026-01-20 3:07 ` Gao Xiang
2026-01-20 6:52 ` Christoph Hellwig
2026-01-20 7:19 ` Gao Xiang
2026-01-22 8:33 ` Christoph Hellwig
2026-01-22 8:40 ` Gao Xiang
2026-01-23 5:39 ` Christoph Hellwig
2026-01-23 5:58 ` Gao Xiang
2026-01-20 13:40 ` Christian Brauner
2026-01-20 14:11 ` Gao Xiang
2026-01-20 12:29 ` Hongbo Li
2026-01-22 14:48 ` Hongbo Li
2026-01-23 6:19 ` Christoph Hellwig
2026-01-20 14:19 ` Gao Xiang
2026-01-20 14:33 ` Gao Xiang
2026-01-21 1:29 ` Hongbo Li [this message]
2026-01-16 9:55 ` [PATCH v15 6/9] erofs: pass inode to trace_erofs_read_folio Hongbo Li
2026-01-16 9:55 ` [PATCH v15 7/9] erofs: support unencoded inodes for page cache share Hongbo Li
2026-01-16 9:55 ` [PATCH v15 8/9] erofs: support compressed " Hongbo Li
2026-01-16 9:55 ` [PATCH v15 9/9] erofs: implement .fadvise " Hongbo Li
2026-01-16 15:46 ` Christoph Hellwig
2026-01-19 1:30 ` Hongbo Li
2026-01-16 15:36 ` [PATCH v15 0/9] erofs: Introduce page cache sharing feature Christoph Hellwig
2026-01-16 16:30 ` Gao Xiang
2026-01-16 16:43 ` Gao Xiang
2026-01-19 1:23 ` Hongbo Li
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=45c45182-e0f3-4b69-869f-5a0a90d543f5@huawei.com \
--to=lihongbo22@huawei.com \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=chao@kernel.org \
--cc=djwong@kernel.org \
--cc=hch@lst.de \
--cc=hsiangkao@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®