[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ac1b5431-e71f-430d-8309-8d007dc449b9@linux.alibaba.com>
Date: Mon, 17 Nov 2025 11:06:21 +0800
From: Gao Xiang <hsiangkao@...ux.alibaba.com>
To: Hongbo Li <lihongbo22@...wei.com>, chao@...nel.org, brauner@...nel.org,
djwong@...nel.org, amir73il@...il.com, joannelkoong@...il.com
Cc: linux-fsdevel@...r.kernel.org, linux-erofs@...ts.ozlabs.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v8 6/9] erofs: introduce the page cache share feature
On 2025/11/14 17:55, Hongbo Li wrote:
> From: Hongzhen Luo <hongzhen@...ux.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.
>
> Signed-off-by: Hongzhen Luo <hongzhen@...ux.alibaba.com>
> Signed-off-by: Hongbo Li <lihongbo22@...wei.com>
> ---
...
> +
> +static int erofs_ishare_file_open(struct inode *inode, struct file *file)
> +{
> + struct file *realfile;
> + struct inode *dedup;
> +
> + dedup = EROFS_I(inode)->ishare;
> + if (!dedup)
> + return -EINVAL;
> +
> + realfile = alloc_file_pseudo(dedup, erofs_ishare_mnt, "erofs_ishare_file",
> + O_RDONLY, &erofs_file_fops);
> + if (IS_ERR(realfile))
> + return PTR_ERR(realfile);
> +
> + file_ra_state_init(&realfile->f_ra, file->f_mapping);
> + realfile->private_data = EROFS_I(inode);
> + file->private_data = realfile;
> + return 0;
Again, as Amir mentioned before, it should be converted to use (at least)
some of backing file interfaces, please see:
file_user_path() and file_user_inode() in include/linux/fs.h
Or are you sure /proc/<pid>/maps is shown as expected?
Thanks,
Gao Xiang
Powered by blists - more mailing lists