From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>
Subject: Re: [PATCH 05/10] mm: abstract vma_merge_new_vma() to use vma_merge_struct
Date: Thu, 8 Aug 2024 16:52:31 +0100 [thread overview]
Message-ID: <fe9ab44a-919a-4a0e-a05a-f6334ab9aed8@lucifer.local> (raw)
In-Reply-To: <82b802e0-94fd-4cca-ad8f-ea2d85bcae64@kernel.org>
On Thu, Aug 08, 2024 at 04:55:07PM GMT, Vlastimil Babka (SUSE) wrote:
> On 8/5/24 14:13, Lorenzo Stoakes wrote:
> > Abstract this function to so we can write tests which use the newly
> > abstracted interface and maintain a stable interface for tests before/after
> > refactoring.
> >
> > We introduce a temporary wrapper vma_merge_new_vma_wrapper() to minimise
> > the code changes, in a subsequent commit we will entirely refactor this
> > function.
> >
> > We also introduce a temporary implementation of vma_merge_modified() for
> > the same reason - maintaining a common interface to the tests, this will be
> > removed when vma_merge_modified() is correctly implemented in a subsequent
> > commit.
> >
> > Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
>
> <snip>
>
> > +struct vm_area_struct *vma_merge_new_vma(struct vma_merge_struct *vmg)
> > {
> > - struct vma_merge_struct vmg = {
> > - .vmi = vmi,
> > - .prev = prev,
> > - .vma = vma,
>
> This line not being addded in the wrapper felt like a mistake. I see in the
> other subthread that it's not so I'll just support your decision to tackle
> it so the code is less surprising.
This is just a wrapper that gets replaced in a subsequent commit.
For new VMAs we don't strictly need vma, as vma_merge() no longer references
this.
This is purposeful for testing purposes.
>
> > - .start = start,
> > - .end = end,
> > - .flags = vma->vm_flags,
> > - .file = vma->vm_file,
> > - .anon_vma = vma->anon_vma,
> > - .pgoff = pgoff,
> > - .policy = vma_policy(vma),
> > - .uffd_ctx = vma->vm_userfaultfd_ctx,
> > - .anon_name = anon_vma_name(vma),
> > - };
> > + if (!vmg->prev) {
> > + vmg->prev = vma_prev(vmg->vmi);
> > + vma_iter_set(vmg->vmi, vmg->start);
> > + }
>
> Admit this is another surprise. The old code didn't do it anywhere AFAICS so
> I don't see why it's now done. Maybe it's necessary for futher changes.
> Could you add a comment or explain it in the changelog, please?
So in the future (actual non-wrapper) version of vma_merge_new_vma(), we do not
require that the previous VMA is specified.
vma_merge() _does_ require this. So we have to go look it up if it's not there.
This is so we can add the tests in the next commit, and have them be completely
identical for the functions _before_ the refactor and afterwards so we can
assert that they pass in both cases.
I'll add a comment accordingly.
>
> > - return vma_merge(&vmg);
> > + return vma_merge(vmg);
> > }
> >
> > /*
>
next prev parent reply other threads:[~2024-08-08 15:52 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-05 12:13 [PATCH 00/10] mm: remove vma_merge() Lorenzo Stoakes
2024-08-05 12:13 ` [PATCH 01/10] tools: improve vma test Makefile Lorenzo Stoakes
2024-08-05 12:13 ` [PATCH 02/10] mm: introduce vma_merge_struct and abstract merge parameters Lorenzo Stoakes
2024-08-06 12:47 ` Petr Tesařík
2024-08-06 13:43 ` Lorenzo Stoakes
2024-08-06 14:06 ` Petr Tesařík
2024-08-06 14:20 ` Lorenzo Stoakes
2024-08-06 14:32 ` Petr Tesařík
2024-08-08 12:49 ` Vlastimil Babka
2024-08-08 17:18 ` Lorenzo Stoakes
2024-08-08 20:07 ` Liam R. Howlett
2024-08-09 10:11 ` Lorenzo Stoakes
2024-08-05 12:13 ` [PATCH 03/10] mm: abstract duplicated policy comparison Lorenzo Stoakes
2024-08-06 12:50 ` Petr Tesařík
2024-08-05 12:13 ` [PATCH 04/10] mm: abstract parameters for vma_expand/shrink() Lorenzo Stoakes
2024-08-06 12:54 ` Petr Tesařík
[not found] ` <f12608ec-9c40-4977-a5a6-479f86b44e80@kernel.org>
2024-08-08 15:45 ` Lorenzo Stoakes
2024-08-08 20:20 ` Liam R. Howlett
2024-08-09 10:18 ` Lorenzo Stoakes
2024-08-14 13:53 ` Lorenzo Stoakes
2024-08-05 12:13 ` [PATCH 05/10] mm: abstract vma_merge_new_vma() to use vma_merge_struct Lorenzo Stoakes
[not found] ` <82b802e0-94fd-4cca-ad8f-ea2d85bcae64@kernel.org>
2024-08-08 15:52 ` Lorenzo Stoakes [this message]
2024-08-05 12:13 ` [PATCH 06/10] tools: add VMA merge tests Lorenzo Stoakes
2024-08-05 12:13 ` [PATCH 07/10] mm: avoid using vma_merge() for new VMAs Lorenzo Stoakes
2024-08-06 13:04 ` Petr Tesařík
2024-08-06 13:44 ` Lorenzo Stoakes
2024-08-08 16:45 ` Vlastimil Babka
2024-08-08 18:02 ` Lorenzo Stoakes
2024-08-08 18:34 ` Liam R. Howlett
2024-08-08 19:06 ` Liam R. Howlett
2024-08-09 10:14 ` Lorenzo Stoakes
2024-08-09 15:23 ` Liam R. Howlett
2024-08-09 17:20 ` Lorenzo Stoakes
2024-08-05 12:13 ` [PATCH 08/10] mm: introduce commit_merge(), abstracting merge operation Lorenzo Stoakes
2024-08-06 13:41 ` Petr Tesařík
2024-08-06 13:48 ` Lorenzo Stoakes
2024-08-06 14:13 ` Petr Tesařík
2024-08-06 14:30 ` Lorenzo Stoakes
2024-08-06 14:39 ` Petr Tesařík
2024-08-09 10:15 ` Vlastimil Babka
2024-08-09 10:53 ` Lorenzo Stoakes
2024-08-05 12:13 ` [PATCH 09/10] mm: refactor vma_merge() into modify-only vma_merge_modified() Lorenzo Stoakes
2024-08-06 13:42 ` Petr Tesařík
2024-08-06 13:52 ` Lorenzo Stoakes
2024-08-09 13:44 ` Vlastimil Babka
2024-08-09 13:57 ` Lorenzo Stoakes
2024-08-05 12:13 ` [PATCH 10/10] mm: rework vm_ops->close() handling on VMA merge Lorenzo Stoakes
2024-08-06 13:55 ` Petr Tesařík
2024-08-06 14:08 ` Lorenzo Stoakes
2024-08-06 14:21 ` Petr Tesařík
2024-08-06 14:42 ` Lorenzo Stoakes
2024-08-09 14:25 ` Vlastimil Babka
2024-08-09 14:37 ` 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=fe9ab44a-919a-4a0e-a05a-f6334ab9aed8@lucifer.local \
--to=lorenzo.stoakes@oracle.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=vbabka@kernel.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