On 28 Apr 2026, at 16:19, David Hildenbrand (Arm) wrote:

> 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?
>

The fd is opened with O_DSYNC, so the data from write() is transferred to
disk when write() returns.

Best Regards,
Yan, Zi

Reply via email to