]> www.infradead.org Git - users/dwmw2/linux.git/commit
mm/mremap: cleanup vma_to_resize()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Fri, 18 Oct 2024 17:41:13 +0000 (13:41 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 7 Nov 2024 04:11:16 +0000 (20:11 -0800)
commit58f1069311db63ed9f330fdba4418a13ab49d843
tree9bae7ae2c9457330b46d0a7ef184dceedbce3312
parent38dc8f495246667b543de4cc646fce2925e4cf3b
mm/mremap: cleanup vma_to_resize()

Patch series "mm/mremap: Remove extra vma tree walk", v2.

An extra vma tree walk was discovered in some mremap call paths during the
discussion on mseal() changes.  This patch set removes the extra vma tree
walk and further cleans up mremap_to().

This patch (of 2):

vma_to_resize() is used in two locations to find and validate the vma for
the mremap location.  One of the two locations already has the vma, which
is then re-found to validate the same vma.

This code can be simplified by moving the vma_lookup() from
vma_to_resize() to mremap_to() and changing the return type to an int
error.

Since the function now just validates the vma, the function is renamed to
resize_is_valid() to better reflect what it is doing.

This commit also adds documentation about the function.

Link: https://lkml.kernel.org/r/20241018174114.2871880-1-Liam.Howlett@oracle.com
Link: https://lkml.kernel.org/r/20241018174114.2871880-2-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Reviewed-by: Pedro Falcato <pedro.falcato@gmail.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jann Horn <jannh@google.com>
Cc: Jeff Xu <jeffxu@chromium.org>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Qi Zheng <zhengqi.arch@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mremap.c