From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>,
Jann Horn <jannh@google.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Xu <peterx@redhat.com>
Subject: Re: [PATCH v3 5/5] mm: defer second attempt at merge on mmap()
Date: Fri, 25 Oct 2024 18:53:47 +0100 [thread overview]
Message-ID: <2e4d37bb-7333-4acc-92d8-c4ccc0d5ee13@lucifer.local> (raw)
In-Reply-To: <10b88eed-7646-499c-9c67-d30469ee2357@suse.cz>
On Fri, Oct 25, 2024 at 07:40:43PM +0200, Vlastimil Babka wrote:
> On 10/25/24 14:26, Lorenzo Stoakes wrote:
> > Rather than trying to merge again when ostensibly allocating a new VMA,
> > instead defer until the VMA is added and attempt to merge the existing
> > range.
> >
> > This way we have no complicated unwinding logic midway through the process
> > of mapping the VMA.
> >
> > In addition this removes limitations on the VMA not being able to be the
> > first in the virtual memory address space which was previously implicitly
> > required.
> >
> > In theory, for this very same reason, we should unconditionally attempt
> > merge here, however this is likely to have a performance impact so it is
> > better to avoid this given the unlikely outcome of a merge.
> >
> > Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
> > Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> > ---
> > mm/vma.c | 55 ++++++++++++++-----------------------------------------
> > 1 file changed, 14 insertions(+), 41 deletions(-)
> >
> > diff --git a/mm/vma.c b/mm/vma.c
> > index 7c690be67910..7194f9449c60 100644
> > --- a/mm/vma.c
> > +++ b/mm/vma.c
> > @@ -19,6 +19,7 @@ struct mmap_state {
> > struct file *file;
> >
> > unsigned long charged;
> > + bool retry_merge;
> >
> > struct vm_area_struct *prev;
> > struct vm_area_struct *next;
> > @@ -2278,8 +2279,9 @@ static int __mmap_prepare(struct mmap_state *map, struct list_head *uf)
> > return 0;
> > }
> >
> > +
> > static int __mmap_new_file_vma(struct mmap_state *map,
> > - struct vm_area_struct **vmap, bool *mergedp)
> > + struct vm_area_struct **vmap)
>
> AFAICS **vmap could become *vma now
Ah yeah good spot you're right, will chase up on respin or do a fix-patch
next week!
>
> > {
> > struct vma_iterator *vmi = map->vmi;
> > struct vm_area_struct *vma = *vmap;
next prev parent reply other threads:[~2024-10-25 17:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-25 12:26 [PATCH v3 0/5] fix error handling in mmap_region() and refactor Lorenzo Stoakes
2024-10-25 12:26 ` [PATCH v3 1/5] tools: testing: add additional vma_internal.h stubs Lorenzo Stoakes
2024-10-25 12:26 ` [PATCH v3 2/5] mm: isolate mmap internal logic to mm/vma.c Lorenzo Stoakes
2024-10-25 12:26 ` [PATCH v3 3/5] mm: refactor __mmap_region() Lorenzo Stoakes
2024-10-25 12:26 ` [PATCH v3 4/5] mm: remove unnecessary reset state logic on merge new VMA Lorenzo Stoakes
2024-10-25 17:35 ` Vlastimil Babka
2024-10-25 12:26 ` [PATCH v3 5/5] mm: defer second attempt at merge on mmap() Lorenzo Stoakes
2024-10-25 17:40 ` Vlastimil Babka
2024-10-25 17:53 ` Lorenzo Stoakes [this message]
2024-10-26 10:34 ` 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=2e4d37bb-7333-4acc-92d8-c4ccc0d5ee13@lucifer.local \
--to=lorenzo.stoakes@oracle.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=peterx@redhat.com \
--cc=torvalds@linux-foundation.org \
--cc=vbabka@suse.cz \
/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