> On Sep 1, 2025, at 16:16, David Hildenbrand <[email protected]> wrote:
>
> On 01.09.25 10:11, wang lian wrote:
>>> I'm confused, don't we have that exact check later in the function?
>>> Your v1 might have been better, unless I am missing something.
>> Hi David,
>> Perhaps you missed this in the v1 feedback:
>> https://lore.kernel.org/linux-mm/[email protected]/
>> ?
>
> We have:
>
> /* smap does not show THPs after mremap, use kpageflags instead */
> thp_size = 0;
> for (i = 0; i < pagesize * 4; i++) {
> if (pte_mapped[i] != (char)i)
> ksft_exit_fail_msg("%ld byte corrupted\n", i);
>
> if (i % pagesize == 0 &&
> !is_backed_by_folio(&pte_mapped[i], 0, pagemap_fd,
> kpageflags_fd))
> thp_size++;
> }
>
> Sure, it's after the split, but if mremap would have corrupted the pages,
> surely
> it would still be corrupt after the mremap+split.
Yes, so I think it is correct to add this check in mremap.
The check after splitting already exists
>
> --
> Cheers
>
> David / dhildenb
>
Best regards,
wang lian