From: sashiko-bot@kernel.org
To: "John Groves" <john@jagalactic.com>
Cc: linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev
Subject: Re: [PATCH V14 06/12] famfs: Introduce mmap and VM fault handling
Date: Sat, 29 Aug 2026 17:26:59 +0000 [thread overview]
Message-ID: <20260829172700.41E8E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <010001a04e81858b-7fcc80df-8aa2-4262-9727-8cb01a0227fb-000000@email.amazonses.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Modifying VMA flags in a legacy .mmap callback breaks VMA merging, leading to memory fragmentation.
--
commit f0dd25d565afad641be49c7b1903722fa578648a
Author: John Groves <john@groves.net>
famfs: Introduce mmap and VM fault handling
This commit adds vm_operations, plus famfs_mmap() and fault handlers.
It is still missing iomap_ops, iomap mapping resolution, and
famfs_ioctl() for setting up file-to-memory mappings.
> diff --git a/fs/famfs/famfs_file.c b/fs/famfs/famfs_file.c
> index 1369fe1824bc8..9c1cd2f674893 100644
> --- a/fs/famfs/famfs_file.c
> +++ b/fs/famfs/famfs_file.c
[ ... ]
> @@ -120,14 +190,51 @@ famfs_dax_write_iter(struct kiocb *iocb, struct iov_iter *from)
> return rc;
> }
>
> +static int
> +famfs_file_mmap(struct file *file, struct vm_area_struct *vma)
> +{
> + struct inode *inode = file_inode(file);
> + struct super_block *sb = inode->i_sb;
> + struct famfs_fs_info *fsi = sb->s_fs_info;
> + ssize_t rc;
> +
> + if (fsi->deverror)
> + return -ENODEV;
> +
> + /*
> + * Gate shared-writable mappings on FAMFS_OPT_WRITE. Reject a mapping
> + * that is already writable, and strip VM_MAYWRITE from a read-only
> + * shared mapping so a later mprotect(PROT_WRITE) cannot upgrade it.
> + * This is best effort: it does not revoke mappings that already exist.
> + */
> + if ((vma->vm_flags & VM_SHARED) &&
> + !famfs_opt_enabled(fsi, FAMFS_OPT_WRITE)) {
> + if (vma->vm_flags & VM_WRITE)
> + return -EPERM;
> + vm_flags_clear(vma, VM_MAYWRITE);
[Severity: Medium]
Does clearing VM_MAYWRITE in the legacy f_op->mmap callback break VMA
merging?
Since this occurs post-merge attempt, these modified flags diverge from the
initially proposed flags. Subsequent adjacent mmaps of the same file with
identical protection will fail to merge.
Should this driver implement f_op->mmap_prepare() instead to modify VMA
flags before the merge attempt?
> + }
> +
> + rc = famfs_file_invalid(inode);
> + if (rc)
> + return (int)rc;
> +
> + file_accessed(file);
> + vma->vm_ops = &famfs_file_vm_ops;
> + vm_flags_set(vma, VM_HUGEPAGE);
[Severity: Medium]
Will setting VM_HUGEPAGE here guarantee that adjacent default mappings fail
to merge?
Like VM_MAYWRITE, modifying this flag post-merge attempt prevents the core MM
subsystem from successfully merging new mappings with existing ones.
Should VM_HUGEPAGE also be set via f_op->mmap_prepare() instead?
> + return 0;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/010001a04e801a4e-8eb212cd-b263-4043-ab65-33e480d2d7d4-000000@email.amazonses.com?part=6
next prev parent reply other threads:[~2026-08-29 17:27 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260829171004.7336-1-john@jagalactic.com>
2026-08-29 17:10 ` [PATCH V14 00/12] Subject: [PATCH v14 00/12] famfs: the Fabric-Attached Memory File System (standalone) John Groves
2026-08-29 17:10 ` [PATCH V14 01/12] dax: replace exported dax_dev_get() with non-allocating dax_dev_find() John Groves
2026-08-29 17:11 ` [PATCH V14 02/12] famfs: Module operations, fs_context, and mount John Groves
2026-08-29 17:28 ` sashiko-bot
2026-08-29 17:11 ` [PATCH V14 03/12] famfs: Add daxdev table and dax notify_failure support John Groves
2026-08-29 17:32 ` sashiko-bot
2026-08-29 17:11 ` [PATCH V14 04/12] famfs: Introduce inode_operations and super_operations John Groves
2026-08-29 17:11 ` [PATCH V14 05/12] famfs: Introduce file_operations read/write John Groves
2026-08-29 17:25 ` sashiko-bot
2026-08-29 17:11 ` [PATCH V14 06/12] famfs: Introduce mmap and VM fault handling John Groves
2026-08-29 17:26 ` sashiko-bot [this message]
2026-08-29 17:11 ` [PATCH V14 07/12] famfs: MAP_CREATE ioctl and fmap ingest (ABI 44) John Groves
2026-08-29 17:30 ` sashiko-bot
2026-08-29 17:12 ` [PATCH V14 08/12] famfs: iomap_begin and file-to-dax offset resolution John Groves
2026-08-29 17:25 ` sashiko-bot
2026-08-29 17:12 ` [PATCH V14 09/12] famfs: Register secondary daxdevs by path (FAMFSIOC_DAXDEV_OPEN) John Groves
2026-08-29 17:25 ` sashiko-bot
2026-08-29 17:13 ` [PATCH V14 10/12] famfs: Add runtime operation-permission (opts) framework John Groves
2026-08-29 17:13 ` [PATCH V14 11/12] famfs: Report device capacity via statfs so df works John Groves
2026-08-29 17:30 ` sashiko-bot
2026-08-29 17:13 ` [PATCH V14 12/12] famfs: Add documentation John Groves
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=20260829172700.41E8E1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=john@jagalactic.com \
--cc=linux-cxl@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
/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