From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: David Hildenbrand <david@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>, Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>, Jann Horn <jannh@google.com>,
Pedro Falcato <pfalcato@suse.de>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH 1/3] mm: introduce new .mmap_prepare() file callback
Date: Fri, 9 May 2025 11:57:17 +0100 [thread overview]
Message-ID: <9b9fd5ce-c303-46c4-acc7-40db1201f70a@lucifer.local> (raw)
In-Reply-To: <5a489fa9-b2c0-4a7d-aa0e-5a97381e6b33@redhat.com>
On Fri, May 09, 2025 at 12:51:14PM +0200, David Hildenbrand wrote:
>
> > > > +
> > > > +static inline int __call_mmap_prepare(struct file *file,
> > > > + struct vm_area_desc *desc)
> > > > +{
> > > > + return file->f_op->mmap_prepare(desc);
> > > > +}
> > >
> > > Hm, is there a way avoid a copy of the exact same code from fs.h, and
> > > essentially test the implementation in fs.h (-> more coverage by using less
> > > duplciated stubs?).
> >
> > Not really, this kind of copying is sadly part of it because we're
> > intentionally isolating vma.c from everything else, and if we try to bring
> > in other headers they import yet others and etc. etc. it becomes a
> > combinatorial explosion potentially.
>
> I guess what would work is inlining __call_mmap_prepare() -- again, rather
> simple wrapper ... and having file_has_valid_mmap_hooks() + call_mmap()
> reside in vma.c. Hm.
>
> As an alternative, we'd really need some separate header that does not allow
> for any other includes, and is essentially only included in the other header
> files.
>
> Duplicating functions in such a way that they can easily go out of sync and
> are not getting tested is really suboptimal. :(
This is a problem that already exists, if minimised. Perfect is the enemy of
good - if we had make these tests existence depend on being able to isolate
_everything_ they'd never happen :)
But I will definitely try to improve the situation, as I couldn't agree more
about de-syncing and it's a concern I share with you.
I think we have a bit of a mess of header files anyway like this, random helpers
put in random places etc.
It doesn't help that a random driver/shm reference call_mmap()...
Anyway, this is somehwat out of scope for this series, as we already have a
number of instances like this and this is just symptomatic of an existing
problem rather than introducing it.
I think one thing to do might be to have a separate header which is explicitly
for functions like these to at least absolutely highlight this case.
The VMA tests need restructuring anyway, so it can be part of a bigger project
to do some work cleaning up there.
todo++; :>)
>
> --
> Cheers,
>
> David / dhildenb
>
next prev parent reply other threads:[~2025-05-09 10:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 11:03 [PATCH 0/3] eliminate mmap() retry merge, add .mmap_prepare hook Lorenzo Stoakes
2025-05-07 11:03 ` [PATCH 1/3] mm: introduce new .mmap_prepare() file callback Lorenzo Stoakes
2025-05-09 10:00 ` David Hildenbrand
2025-05-09 10:45 ` Lorenzo Stoakes
2025-05-09 10:51 ` David Hildenbrand
2025-05-09 10:57 ` Lorenzo Stoakes [this message]
2025-05-09 10:59 ` David Hildenbrand
2025-05-07 11:03 ` [PATCH 2/3] mm: secretmem: convert to .mmap_prepare() hook Lorenzo Stoakes
2025-05-09 9:45 ` David Hildenbrand
2025-05-09 10:38 ` Lorenzo Stoakes
2025-05-07 11:03 ` [PATCH 3/3] mm/vma: remove mmap() retry merge Lorenzo Stoakes
2025-05-09 9:45 ` David Hildenbrand
2025-05-09 10:38 ` Lorenzo Stoakes
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=9b9fd5ce-c303-46c4-acc7-40db1201f70a@lucifer.local \
--to=lorenzo.stoakes@oracle.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=david@redhat.com \
--cc=jack@suse.cz \
--cc=jannh@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=pfalcato@suse.de \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.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®