linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.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 12:51:14 +0200	[thread overview]
Message-ID: <5a489fa9-b2c0-4a7d-aa0e-5a97381e6b33@redhat.com> (raw)
In-Reply-To: <9f479d46-cf06-4dfe-ac26-21fce0aafa06@lucifer.local>


>>> +
>>> +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. :(

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2025-05-09 10:51 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 [this message]
2025-05-09 10:57         ` Lorenzo Stoakes
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=5a489fa9-b2c0-4a7d-aa0e-5a97381e6b33@redhat.com \
    --to=david@redhat.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --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=lorenzo.stoakes@oracle.com \
    --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