lkml.org 
[lkml]   [2026]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v5] selftests/mm: khugepaged: initialize file contents via mmap
Date
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 <agarwal.vineet2006@gmail.com>
>
> 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 <ziy@nvidia.com>
Tested-by: Zi Yan <ziy@nvidia.com>

Best Regards,
Yan, Zi

\
 
 \ /
  Last update: 2026-04-29 15:07    [W:0.084 / U:4.461 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog