From: Vlastimil Babka <vbabka@suse.cz>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: "Liam R . Howlett" <Liam.Howlett@oracle.com>,
Jann Horn <jannh@google.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Harry Yoo <harry.yoo@oracle.com>,
Yosry Ahmed <yosry.ahmed@linux.dev>,
Oliver Sang <oliver.sang@intel.com>,
Yi Lai <yi1.lai@linux.intel.com>
Subject: Re: [PATCH v3 4/7] mm/mremap: initial refactor of move_vma()
Date: Mon, 31 Mar 2025 11:13:41 +0200 [thread overview]
Message-ID: <cf12cbac-e8c7-45dd-ac5a-93a60f6e87be@suse.cz> (raw)
In-Reply-To: <b2fb6b9c-376d-4e9b-905e-26d847fd3865@lucifer.local>
On 3/30/25 18:52, Lorenzo Stoakes wrote:
> On Mon, Mar 10, 2025 at 08:50:37PM +0000, Lorenzo Stoakes wrote:
>> Update move_vma() to use the threaded VRM object, de-duplicate code and
>> separate into smaller functions to aid readability and debug-ability.
>>
>> This in turn allows further simplification of expand_vma() as we can
>> simply thread VRM through the function.
>
> [snip]
>
> Andrew - I enclose a fix-patch for the issue kindly reported in [0] by Yi
> Lai. Since you've not sent the PR to Linus yet maybe you could squash this
> in? Otherwise obviously one for 6.15-rc1.
>
> I've tested against the repro and confirm it fixes it, also the fix is
> 'obvious' as is the cause. I have replied to [0] with an explanation there
> also inline.
>
> Apologies for missing this before!
>
> Thanks, Lorenzo
>
> [0]: https://lore.kernel.org/linux-mm/Z+lcvEIHMLiKVR1i@ly-workstation/
>
> ----8<----
> From 3709f42feb30e2cfe2f39527d4cd8c74a9e8b724 Mon Sep 17 00:00:00 2001
> From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> Date: Sun, 30 Mar 2025 17:20:48 +0100
> Subject: [PATCH] mm/mremap: do not set vrm->vma NULL immediately prior to
> checking it
>
> This seems rather unwise. If we cannot merge, extend, then we need to
> recall the original VMA to see if we need to uncharge.
>
> If we do need to, do so.
>
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Can we get a testcase that hits this path? :)
>
> ---
> mm/mremap.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mm/mremap.c b/mm/mremap.c
> index 0865387531ed..7db9da609c84 100644
> --- a/mm/mremap.c
> +++ b/mm/mremap.c
> @@ -1561,11 +1561,12 @@ static unsigned long expand_vma_in_place(struct vma_remap_struct *vrm)
> * adjacent to the expanded vma and otherwise
> * compatible.
> */
> - vma = vrm->vma = vma_merge_extend(&vmi, vma, vrm->delta);
> + vma = vma_merge_extend(&vmi, vma, vrm->delta);
> if (!vma) {
> vrm_uncharge(vrm);
> return -ENOMEM;
> }
> + vrm->vma = vma;
>
> vrm_stat_account(vrm, vrm->delta);
>
> --
> 2.49.0
next prev parent reply other threads:[~2025-03-31 16:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-10 20:50 [PATCH v3 0/7] refactor mremap and fix bug Lorenzo Stoakes
2025-03-10 20:50 ` [PATCH v3 1/7] mm/mremap: correctly handle partial mremap() of VMA starting at 0 Lorenzo Stoakes
2025-03-10 20:50 ` [PATCH v3 2/7] mm/mremap: refactor mremap() system call implementation Lorenzo Stoakes
2025-03-10 20:50 ` [PATCH v3 3/7] mm/mremap: introduce and use vma_remap_struct threaded state Lorenzo Stoakes
2025-03-13 7:52 ` Harry Yoo
2025-03-10 20:50 ` [PATCH v3 4/7] mm/mremap: initial refactor of move_vma() Lorenzo Stoakes
2025-03-30 15:01 ` Lai, Yi
2025-03-30 16:46 ` Lorenzo Stoakes
2025-03-30 16:52 ` Lorenzo Stoakes
2025-03-31 9:13 ` Vlastimil Babka [this message]
2025-03-31 9:33 ` Lorenzo Stoakes
2025-03-10 20:50 ` [PATCH v3 5/7] mm/mremap: complete " Lorenzo Stoakes
2025-03-10 20:50 ` [PATCH v3 6/7] mm/mremap: refactor move_page_tables(), abstracting state Lorenzo Stoakes
2025-03-10 20:50 ` [PATCH v3 7/7] mm/mremap: thread state through move page table operation 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=cf12cbac-e8c7-45dd-ac5a-93a60f6e87be@suse.cz \
--to=vbabka@suse.cz \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=harry.yoo@oracle.com \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=oliver.sang@intel.com \
--cc=yi1.lai@linux.intel.com \
--cc=yosry.ahmed@linux.dev \
/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