Re: [PATCH v4] selftests/mm: khugepaged: initialize file contents via mmap
From: David Hildenbrand (Arm)
Date: Tue Apr 28 2026 - 16:23:13 EST
On 4/28/26 22:17, Zi Yan wrote:
> On 28 Apr 2026, at 16:07, David Hildenbrand (Arm) wrote:
>
>> On 4/28/26 21:56, Zi Yan wrote:
>>>
>>>
>>> This patch breaks the khugepaged test for READ_ONLY_THP_FOR_FS.
>>>
>>> When I ran sudo ./khugepaged all:file ~/ on ext4,
>>>
>>> collapse_max_ptes_none (khugepaged:file) fails.
>>
>> madvise() still works? Is it maybe because of dirty folios? (but that should
>> also be the case on write ...)
>
> I asked codex instead.
>
> Basically, mmap(MMAP_SHARED) makes the written folio dirty and the folio
> survives the later drop_caches. Adding msync() fixes the issue.
But why doesn't the write() make the folios dirty? Or are we running into some
race condition where the old code just worked by chance?
--
Cheers,
David