[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <01c99e22-7b12-4ac0-863a-b177c8ac1041@suse.cz>
Date: Thu, 10 Jul 2025 13:38:16 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Peter Xu <peterx@...hat.com>, Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
"Liam R . Howlett" <Liam.Howlett@...cle.com>, Jann Horn <jannh@...gle.com>,
Pedro Falcato <pfalcato@...e.de>, Rik van Riel <riel@...riel.com>,
linux-mm@...ck.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-kselftest@...r.kernel.org
Subject: Re: [PATCH 02/10] mm/mremap: refactor initial parameter sanity checks
On 7/7/25 07:27, Lorenzo Stoakes wrote:
> We are currently checking some things later, and some things
> immediately. Aggregate the checks and avoid ones that need not be made.
>
> Simplify things by aligning lengths immediately. Defer setting the delta
> parameter until later, which removes some duplicate code in the hugetlb
> case.
>
> We can safely perform the checks moved from mremap_to() to
> check_mremap_params() because:
>
> * If we set a new address via vrm_set_new_addr(), then this is guaranteed
> to not overlap nor to position the new VMA past TASK_SIZE, so there's no
> need to check these later.
>
> * We can simply page align lengths immediately. We do not need to check for
> overlap nor TASK_SIZE sanity after hugetlb alignment as this asserts
> addresses are huge-aligned, then huge-aligns lengths, rounding down. This
> means any existing overlap would have already been caught.
>
> Moving things around like this lays the groundwork for subsequent changes
> to permit operations on batches of VMAs.
>
> No functional change intended.
>
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Reviewed-by: Vlastimil Babka <vbabka@...e.cz>
Powered by blists - more mailing lists