On Tue, Sep 02, 2025 at 06:25:36PM +0200, David Hildenbrand wrote:
There is room for improvement, so let's clean up a bit:
(1) Define "4" as a constant.
(2) SKIP if we fail to allocate all THPs (e.g., fragmented) and add recovery code for all other failure cases: no need to exit the test.
(3) Rename "len" to thp_area_size, and "one_page" to "thp_area".
(4) Allocate a new area "page_area" into which we will mremap the pages; add "page_area_size". Now we can easily merge the two mremap instances into a single one.
(5) Iterate THPs instead of bytes when checking for missed THPs after mremap.
(6) Rename "pte_mapped2" to "tmp", used to verify mremap(MAP_FIXED) result.
(7) Split the corruption test from the failed-split test, so we can just iterate bytes vs. thps naturally.
(8) Extend comments and clarify why we are using mremap in the first place.
Reviewed-by: Zi Yan ziy@nvidia.com Signed-off-by: David Hildenbrand david@redhat.com
Reviewed-by: Wei Yang richard.weiyang@gmail.com