[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ac65e657-bfd5-4e6a-a909-79107d23cd1c@redhat.com>
Date: Fri, 9 May 2025 12:59:17 +0200
From: David Hildenbrand <david@...hat.com>
To: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
"Liam R . Howlett" <Liam.Howlett@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>, Mike Rapoport <rppt@...nel.org>,
Suren Baghdasaryan <surenb@...gle.com>, Michal Hocko <mhocko@...e.com>,
Jann Horn <jannh@...gle.com>, Pedro Falcato <pfalcato@...e.de>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH 1/3] mm: introduce new .mmap_prepare() file callback
On 09.05.25 12:57, Lorenzo Stoakes wrote:
> 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()...
Yes ...
>
> 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.
Yes, and then just include it in the relevant header files.
>
> The VMA tests need restructuring anyway, so it can be part of a bigger project
> to do some work cleaning up there.
Cool!
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists