On 29 Apr 2026, at 7:58, Vineet Agarwal wrote:

> file_setup_area() currently allocates anonymous memory, fills it,
> and writes it into the backing file used for collapse testing.
>
> Instead of copying data through write(), resize the file with
> ftruncate(), map it directly with MAP_SHARED, and initialize the
> mapped area in place.
>
> This simplifies the setup path and avoids the need for explicit
> partial write handling.
>
> Signed-off-by: Vineet Agarwal <[email protected]>
>
> v4 -> v5:
>   - Restore msync() to keep folios clean for READ_ONLY_THP_FOR_FS
>   - Remove O_DSYNC since msync() handles synchronization
>   - Simplify mmap() check and drop unnecessary cleanup in error paths
> ---
>  tools/testing/selftests/mm/khugepaged.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
>
LGTM. And it no longer regresses for READ_ONLY_THP_FOR_FS tests. Thanks.

Reviewed-by: Zi Yan <[email protected]>
Tested-by: Zi Yan <[email protected]>

Best Regards,
Yan, Zi

Reply via email to