Re: [PATCH v2 2/7] mm/mremap: refactor mremap() system call implementation

From: Vlastimil Babka
Date: Thu Mar 06 2025 - 08:56:57 EST


On 3/6/25 11:33, Lorenzo Stoakes wrote:
> 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.
>
> Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
> Reviewed-by: Harry Yoo <harry.yoo@xxxxxxxxxx>

Reviewed-by: Vlastimil Babka <vbabka@xxxxxxx>