]> www.infradead.org Git - users/jedix/linux-maple.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>
Fri, 1 Nov 2024 04:29:14 +0000 (21:29 -0700)
commitbf87d02038db537f13f3f485f5dc42f6e95521e6
treec96f066b55fb2c66947a1748597f9d8137effc9f
parent3cca20d1a8272f59c144cec91432d1957f36f153
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