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/E0C570E7-C4CD-4E41-9590-DDB64757CA2C@nvidia... ?
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.