]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/mremap: refactor mremap() system call implementation
authorLorenzo Stoakes <lorenzo.stoakes@oracle.com>
Mon, 3 Mar 2025 11:08:32 +0000 (11:08 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 4 Mar 2025 05:50:48 +0000 (21:50 -0800)
commitc999742cef6c83efdef57bfacb54e4511bba4e2e
tree7c76b1facf596f4dbf4466b6ed5d469bc2728bdf
parent2229fc592f07696aa2d2db5d15c277e0543fe726
mm/mremap: refactor mremap() system call implementation

Place checks into a separate function so the mremap() system call is less
egregiously long, remove unnecessary mremap_to() offset_in_page() check
and just check that earlier so we keep all such basic checks together.

Separate out the VMA in-place expansion, hugetlb and expand/move logic
into separate, readable functions.

De-duplicate code where possible, add comments and ensure that all error
handling explicitly specifies the error at the point of it occurring
rather than setting a prefixed error value and implicitly setting (which
is bug prone).

This lays the groundwork for subsequent patches further simplifying and
extending the mremap() implementation.

Link: https://lkml.kernel.org/r/e6b80d8f58dd2c6a30643d70405dec3e9a385f7f.1740911247.git.lorenzo.stoakes@oracle.com
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Harry Yoo <harry.yoo@oracle.com>
Cc: Jann Horn <jannh@google.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mremap.c