selftests/mm: fix split_huge_page_test for folio_split() tests.
Subsystems (4)
Zi Yan
reviewerPATCH 1/1 selftests/mm: fix split_huge_page_test for folio_split() tests.
PID_FMT does not have an offset field, so folio_split() tests are not performed. Add PID_FMT_OFFSET with an offset field and use it to perform folio_split() tests.
--- tools/testing/selftests/mm/split_huge_page_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/mm/split_huge_page_test.c +2 -1
@@ -31,6 +31,7 @@ uint64_t pmd_pagesize;#define INPUT_MAX 80#define PID_FMT "%d,0x%lx,0x%lx,%d" +#define PID_FMT_OFFSET "%d,0x%lx,0x%lx,%d,%d"#define PATH_FMT "%s,0x%lx,0x%lx,%d"#define PFN_MASK ((1UL<<55)-1)
@@ -483,7 +484,7 @@ void split_thp_in_pagecache_to_order_at(size_t fd_size, const char *fs_loc,write_debugfs (PID_FMT ,getpid (), (uint64_t )addr, (uint64_t )addr + fd_size, order); else - write_debugfs(PID_FMT, getpid(), (uint64_t)addr, + write_debugfs(PID_FMT_OFFSET, getpid(), (uint64_t)addr, (uint64_t)addr + fd_size, order, offset);for (i =0 ; i < fd_size; i++)
Signature · 1 line
2.47.2
Quoted 6 lines · Zi Yan
PID_FMTdoes not have an offset field, sofolio_split()tests are not performed. AddPID_FMT_OFFSETwith an offset field and use it to performfolio_split()tests.Fixes 80a5c494c89f ("selftests/mm: add tests for folio_split(), buddy allocator like split")Signed-off-by Zi Yan <[email protected]>
LGTM.
Quoted 25 lines
--- tools/testing/selftests/mm/split_huge_page_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/mm/split_huge_page_test.c +2
-1@@ -31,6 +31,7 @@ uint64_t pmd_pagesize;#define INPUT_MAX 80#define PID_FMT "%d,0x%lx,0x%lx,%d" +#define PID_FMT_OFFSET "%d,0x%lx,0x%lx,%d,%d"#define PATH_FMT "%s,0x%lx,0x%lx,%d"#define PFN_MASK ((1UL<<55)-1)@@ -483,7 +484,7 @@ void split_thp_in_pagecache_to_order_at(size_t fd_size, const char *fs_loc,write_debugfs (PID_FMT ,getpid (), (uint64_t )addr, (uint64_t )addr + fd_size, order); else - write_debugfs(PID_FMT, getpid(), (uint64_t)addr, + write_debugfs(PID_FMT_OFFSET, getpid(), (uint64_t)addr, (uint64_t)addr + fd_size, order, offset);for (i =0 ; i < fd_size; i++)
On 7/9/25 6:57 AM, Zi Yan wrote:
Hi Zi Yan
Quoted 24 lines
PID_FMTdoes not have an offset field, sofolio_split()tests are not performed. AddPID_FMT_OFFSETwith an offset field and use it to performfolio_split()tests.Fixes 80a5c494c89f ("selftests/mm: add tests for folio_split(), buddy allocator like split")Signed-off-by Zi Yan <[email protected]>--- tools/testing/selftests/mm/split_huge_page_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/mm/split_huge_page_test.c +1
-0@@ -31,6 +31,7 @@ uint64_t pmd_pagesize;#define INPUT_MAX 80#define PID_FMT "%d,0x%lx,0x%lx,%d" +#define PID_FMT_OFFSET "%d,0x%lx,0x%lx,%d,%d"#define PATH_FMT "%s,0x%lx,0x%lx,%d"#define PFN_MASK ((1UL<<55)-1)
tools/testing/selftests/mm/split_huge_page_test.c void split_thp_in_pagecache_to_order_at(size_t fd_size, const char *fs_loc, · line 490
Quoted 8 lines
tools/testing/selftests/mm/split_huge_page_test.c +1
-1@@ -483,7 +484,7 @@ void split_thp_in_pagecache_to_order_at(size_t fd_size, const char *fs_loc,write_debugfs (PID_FMT ,getpid (), (uint64_t )addr, (uint64_t )addr + fd_size, order); else - write_debugfs(PID_FMT, getpid(), (uint64_t)addr, + write_debugfs(PID_FMT_OFFSET, getpid(), (uint64_t)addr, (uint64_t)addr + fd_size, order, offset);for (i =0 ; i < fd_size; i++)
This looks good to me.
I tested it on my system, and the test is passing.
ok 17 Split PMD-mapped pagecache folio to order 0 at in-folio offset 0 passed ok 18 Split PMD-mapped pagecache folio to order 0 at in-folio offset 8 passed ok 19 Split PMD-mapped pagecache folio to order 0 at in-folio offset 16 passed ok 20 Split PMD-mapped pagecache folio to order 0 at in-folio offset 24 passed ok 21 Split PMD-mapped pagecache folio to order 1 at in-folio offset 0 passed ok 22 Split PMD-mapped pagecache folio to order 1 at in-folio offset 8 passed ok 23 Split PMD-mapped pagecache folio to order 1 at in-folio offset 16 passed ok 24 Split PMD-mapped pagecache folio to order 1 at in-folio offset 24 passed ok 25 Split PMD-mapped pagecache folio to order 2 at in-folio offset 0 passed ok 26 Split PMD-mapped pagecache folio to order 2 at in-folio offset 8 passed ok 27 Split PMD-mapped pagecache folio to order 2 at in-folio offset 16 passed ok 28 Split PMD-mapped pagecache folio to order 2 at in-folio offset 24 passed ok 29 Split PMD-mapped pagecache folio to order 3 at in-folio offset 0 passed ok 30 Split PMD-mapped pagecache folio to order 3 at in-folio offset 8 passed ok 31 Split PMD-mapped pagecache folio to order 3 at in-folio offset 16 passed ok 32 Split PMD-mapped pagecache folio to order 3 at in-folio offset 24 passed ok 33 Split PMD-mapped pagecache folio to order 4 at in-folio offset 0 passed ok 34 Split PMD-mapped pagecache folio to order 4 at in-folio offset 16 passed
Feel free to add:
Quoted 6 lines · Zi Yan
PID_FMTdoes not have an offset field, sofolio_split()tests are not performed. AddPID_FMT_OFFSETwith an offset field and use it to performfolio_split()tests.Fixes 80a5c494c89f ("selftests/mm: add tests for folio_split(), buddy allocator like split")Signed-off-by Zi Yan <[email protected]>
LGTM, so:
Quoted 28 lines
--- tools/testing/selftests/mm/split_huge_page_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/mm/split_huge_page_test.c +2
-2@@ -31,6 +31,7 @@ uint64_t pmd_pagesize;#define INPUT_MAX 80#define PID_FMT "%d,0x%lx,0x%lx,%d" +#define PID_FMT_OFFSET "%d,0x%lx,0x%lx,%d,%d"#define PATH_FMT "%s,0x%lx,0x%lx,%d"#define PFN_MASK ((1UL<<55)-1)@@ -483,7 +484,7 @@ void split_thp_in_pagecache_to_order_at(size_t fd_size, const char *fs_loc,write_debugfs (PID_FMT ,getpid (), (uint64_t )addr, (uint64_t )addr + fd_size, order); else - write_debugfs(PID_FMT, getpid(), (uint64_t)addr, + write_debugfs(PID_FMT_OFFSET, getpid(), (uint64_t)addr, (uint64_t)addr + fd_size, order, offset);for (i =0 ; i < fd_size; i++) --2.47.2
Quoted 23 lines · Zi Yan
PID_FMTdoes not have an offset field, sofolio_split()tests are not performed. AddPID_FMT_OFFSETwith an offset field and use it to performfolio_split()tests.Fixes 80a5c494c89f ("selftests/mm: add tests for folio_split(), buddy allocator like split")Signed-off-by Zi Yan <[email protected]>--- tools/testing/selftests/mm/split_huge_page_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/mm/split_huge_page_test.c +1
-0@@ -31,6 +31,7 @@ uint64_t pmd_pagesize;#define INPUT_MAX 80#define PID_FMT "%d,0x%lx,0x%lx,%d" +#define PID_FMT_OFFSET "%d,0x%lx,0x%lx,%d,%d"#define PATH_FMT "%s,0x%lx,0x%lx,%d"#define PFN_MASK ((1UL<<55)-1)
tools/testing/selftests/mm/split_huge_page_test.c void split_thp_in_pagecache_to_order_at(size_t fd_size, const char *fs_loc, · line 490
Quoted 8 lines
tools/testing/selftests/mm/split_huge_page_test.c +1
-1@@ -483,7 +484,7 @@ void split_thp_in_pagecache_to_order_at(size_t fd_size, const char *fs_loc,write_debugfs (PID_FMT ,getpid (), (uint64_t )addr, (uint64_t )addr + fd_size, order); else - write_debugfs(PID_FMT, getpid(), (uint64_t)addr, + write_debugfs(PID_FMT_OFFSET, getpid(), (uint64_t)addr, (uint64_t)addr + fd_size, order, offset);for (i =0 ; i < fd_size; i++)
So I assume the tests still passed. Would there be a way to have made them fail? (IOW, detect that the wrong kind-of split was performed)
Signature · 3 lines
Cheers, David / dhildenb
Zi Yan
reviewerQuoted 23 lines · David Hildenbrand
Quoted 22 lines · Zi Yan
PID_FMTdoes not have an offset field, sofolio_split()tests are not performed. AddPID_FMT_OFFSETwith an offset field and use it to performfolio_split()tests.Fixes 80a5c494c89f ("selftests/mm: add tests for folio_split(), buddy allocator like split")Signed-off-by Zi Yan <[email protected]>--- tools/testing/selftests/mm/split_huge_page_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/mm/split_huge_page_test.c +1
-0@@ -31,6 +31,7 @@ uint64_t pmd_pagesize;#define INPUT_MAX 80#define PID_FMT "%d,0x%lx,0x%lx,%d" +#define PID_FMT_OFFSET "%d,0x%lx,0x%lx,%d,%d"#define PATH_FMT "%s,0x%lx,0x%lx,%d"#define PFN_MASK ((1UL<<55)-1)@@ -483,7 +484,7 @@ void split_thp_in_pagecache_to_order_at(size_t fd_size, const char *fs_loc, write_debugfs(PID_FMT, getpid(), (uint64_t)addr,
Quoted 8 lines
tools/testing/selftests/mm/split_huge_page_test.c void split_thp_in_pagecache_to_order_at(size_t fd_size, const char *fs_loc, · line 490
Quoted 6 lines
tools/testing/selftests/mm/split_huge_page_test.c +1
-1(uint64_t)addr + fd_size, order); else - write_debugfs(PID_FMT, getpid(), (uint64_t)addr, + write_debugfs(PID_FMT_OFFSET, getpid(), (uint64_t)addr, (uint64_t)addr + fd_size, order, offset);for (i =0 ; i < fd_size; i++)So I assume the tests still passed. Would there be a way to have made them fail? (IOW, detect that the wrong kind-of split was performed)
Only if the initial PMD page is not split. To detect whether all after-split folios are the size we expect, additional code that reads kpageflags is needed. I will put it in my TODO to make this test more robust.
Quoted 2 lines
Thanks.
Best Regards,
Yan, Zi