* [PATCH] selftests/mm: hmm: give migrate_remap_fault a longer timeout @ 2026-11-19 13:39 Zenghui Yu 2026-11-19 13:54 ` Zenghui Yu 2026-11-19 22:31 ` Alistair Popple 0 siblings, 2 replies; 7+ messages in thread From: Zenghui Yu @ 2026-11-19 13:39 UTC (permalink / raw) To: linux-mm Cc: jgg, leon, akpm, david, liam, vbabka, rppt, mhocko, Zenghui Yu (Huawei) From: "Zenghui Yu (Huawei)" <zenghui.yu@linux.dev> migrate_remap_fault sizes its working set from the PMD page size and runs 24 combinations of migration/mremap parameters. On arm64 with 64K base pages the PMD size is 512MB, so the test churns through tens of gigabytes of memory and takes ~32 seconds on my test machine. This just exceeds the kselftest harness's 30s default per-test timeout (TEST_TIMEOUT_DEFAULT), and the test gets killed with "Test terminated by timeout" even though it is making steady progress. Raise the timeout to 120 seconds via TEST_F_TIMEOUT, so that the test can run to completion on configurations with large PMD sizes. Signed-off-by: Zenghui Yu (Huawei) <zenghui.yu@linux.dev> --- tools/testing/selftests/mm/hmm-tests.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/mm/hmm-tests.c b/tools/testing/selftests/mm/hmm-tests.c index e5f273ca84c1..840015cdd209 100644 --- a/tools/testing/selftests/mm/hmm-tests.c +++ b/tools/testing/selftests/mm/hmm-tests.c @@ -2221,7 +2221,7 @@ TEST_F(hmm, migrate_partial_unmap_fault) } } -TEST_F(hmm, migrate_remap_fault) +TEST_F_TIMEOUT(hmm, migrate_remap_fault, 120) { struct hmm_buffer *buffer; unsigned long npages; -- 2.56.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] selftests/mm: hmm: give migrate_remap_fault a longer timeout 2026-11-19 13:39 [PATCH] selftests/mm: hmm: give migrate_remap_fault a longer timeout Zenghui Yu @ 2026-11-19 13:54 ` Zenghui Yu 2026-11-19 22:31 ` Alistair Popple 1 sibling, 0 replies; 7+ messages in thread From: Zenghui Yu @ 2026-11-19 13:54 UTC (permalink / raw) To: linux-mm; +Cc: jgg, leon, akpm, david, liam, vbabka, rppt, mhocko On 11/19/26 9:39 PM, Zenghui Yu wrote: > From: "Zenghui Yu (Huawei)" <zenghui.yu@linux.dev> > > migrate_remap_fault sizes its working set from the PMD page size and runs > 24 combinations of migration/mremap parameters. On arm64 with 64K base > pages the PMD size is 512MB, so the test churns through tens of gigabytes > of memory and takes ~32 seconds on my test machine. This just exceeds the > kselftest harness's 30s default per-test timeout (TEST_TIMEOUT_DEFAULT), > and the test gets killed with "Test terminated by timeout" even though it > is making steady progress. This (and any) failure of the hmm-tests binary is silently reported as PASS by the kselftest framework because test_hmm.sh always exits with 0, which needs to be fixed separately. Thanks, Zenghui ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] selftests/mm: hmm: give migrate_remap_fault a longer timeout 2026-11-19 13:39 [PATCH] selftests/mm: hmm: give migrate_remap_fault a longer timeout Zenghui Yu 2026-11-19 13:54 ` Zenghui Yu @ 2026-11-19 22:31 ` Alistair Popple 2026-11-25 5:37 ` Andrew Morton 1 sibling, 1 reply; 7+ messages in thread From: Alistair Popple @ 2026-11-19 22:31 UTC (permalink / raw) To: Zenghui Yu Cc: linux-mm, jgg, leon, akpm, david, liam, vbabka, rppt, mhocko, balbirs On 2026-11-20 at 00:39 +1100, Zenghui Yu <zenghui.yu@linux.dev> wrote... > From: "Zenghui Yu (Huawei)" <zenghui.yu@linux.dev> > > migrate_remap_fault sizes its working set from the PMD page size and runs > 24 combinations of migration/mremap parameters. On arm64 with 64K base > pages the PMD size is 512MB, so the test churns through tens of gigabytes > of memory and takes ~32 seconds on my test machine. This just exceeds the > kselftest harness's 30s default per-test timeout (TEST_TIMEOUT_DEFAULT), > and the test gets killed with "Test terminated by timeout" even though it > is making steady progress. > > Raise the timeout to 120 seconds via TEST_F_TIMEOUT, so that the test can > run to completion on configurations with large PMD sizes. I guess the alternative is to reduce the number of test combinations, but that seems like it would reduce coverage so this seems reasonable. Adding Balbir to CC in case he has thoughts though. Reviewed-by: Alistair Popple <apopple@nvidia.com> > Signed-off-by: Zenghui Yu (Huawei) <zenghui.yu@linux.dev> > --- > tools/testing/selftests/mm/hmm-tests.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/mm/hmm-tests.c b/tools/testing/selftests/mm/hmm-tests.c > index e5f273ca84c1..840015cdd209 100644 > --- a/tools/testing/selftests/mm/hmm-tests.c > +++ b/tools/testing/selftests/mm/hmm-tests.c > @@ -2221,7 +2221,7 @@ TEST_F(hmm, migrate_partial_unmap_fault) > } > } > > -TEST_F(hmm, migrate_remap_fault) > +TEST_F_TIMEOUT(hmm, migrate_remap_fault, 120) > { > struct hmm_buffer *buffer; > unsigned long npages; > -- > 2.56.0 > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] selftests/mm: hmm: give migrate_remap_fault a longer timeout 2026-11-19 22:31 ` Alistair Popple @ 2026-11-25 5:37 ` Andrew Morton 2026-11-25 5:50 ` Balbir Singh 2026-11-25 9:22 ` Zenghui Yu 0 siblings, 2 replies; 7+ messages in thread From: Andrew Morton @ 2026-11-25 5:37 UTC (permalink / raw) To: Alistair Popple Cc: Zenghui Yu, linux-mm, jgg, leon, david, liam, vbabka, rppt, mhocko, balbirs On Fri, 20 Nov 2026 09:31:23 +1100 Alistair Popple <apopple@nvidia.com> wrote: > On 2026-11-20 at 00:39 +1100, Zenghui Yu <zenghui.yu@linux.dev> wrote... > > From: "Zenghui Yu (Huawei)" <zenghui.yu@linux.dev> > > > > migrate_remap_fault sizes its working set from the PMD page size and runs > > 24 combinations of migration/mremap parameters. On arm64 with 64K base > > pages the PMD size is 512MB, so the test churns through tens of gigabytes > > of memory and takes ~32 seconds on my test machine. This just exceeds the > > kselftest harness's 30s default per-test timeout (TEST_TIMEOUT_DEFAULT), > > and the test gets killed with "Test terminated by timeout" even though it > > is making steady progress. > > > > Raise the timeout to 120 seconds via TEST_F_TIMEOUT, so that the test can > > run to completion on configurations with large PMD sizes. > > I guess the alternative is to reduce the number of test combinations, but that > seems like it would reduce coverage so this seems reasonable. Adding Balbir to > CC in case he has thoughts though. 32 seconds is just too long. We have ~1200 seltests! Imagine if they all did that. Can we figure out how to make this test a lot faster? I slop-coded a thing (below) which halves the runtime but it still needs to be taught to do at least one full-PMD MADV_NOHUGEPAGE run on systems with a PMD larger than 2 MiB. And 15 seconds still sucks. See, if running all selftest takes multiple hours then lots of people just aren't going to run selftests and that harms our overall project. They need to be snappy. If we can't do this then I suggest we find a general way of excluding exceptionally slow tests from run_tests unless the user explicitly passes some --i-am-very-patient arg. But that's out of scope for this present timeout issue. Zenghui, are you able to figure out some way of speeding up hmm-tests.c to avoid the timeout without compromising test coverage too much? Thanks. --- a/tools/testing/selftests/mm/hmm-tests.c~selftests-mm-hmm-speed-up-migrate_remap_fault +++ a/tools/testing/selftests/mm/hmm-tests.c @@ -2250,7 +2250,8 @@ TEST_F(hmm, migrate_remap_fault) { struct hmm_buffer *buffer; unsigned long npages; - unsigned long size = pmd_psize(); + unsigned long pmd_size = pmd_psize(); + unsigned long size; unsigned long offsets[3]; unsigned long i; void *old_ptr, *new_ptr = NULL; @@ -2258,16 +2259,17 @@ TEST_F(hmm, migrate_remap_fault) int *ptr; int ret, j, use_thp, dont_unmap, before; - if (!size) - size = TWOMEG; - - offsets[0] = 0; - offsets[1] = size / 4; - offsets[2] = size / 2; + if (!pmd_size) + pmd_size = TWOMEG; for (before = 0; before < 2; ++before) { for (dont_unmap = 0; dont_unmap < 2; ++dont_unmap) { for (use_thp = 0; use_thp < 2; ++use_thp) { + /* Keep a full PMD for the huge-page cases. */ + size = use_thp || pmd_size <= TWOMEG ? pmd_size : TWOMEG; + offsets[0] = 0; + offsets[1] = size / 4; + offsets[2] = size / 2; for (j = 0; j < ARRAY_SIZE(offsets); ++j) { int flags = MREMAP_MAYMOVE | MREMAP_FIXED; @@ -2309,8 +2311,10 @@ TEST_F(hmm, migrate_remap_fault) /* Check what the device read. */ for (i = 0, ptr = buffer->mirror; - i < size / sizeof(*ptr); ++i) - ASSERT_EQ(ptr[i], i); + i < size / sizeof(*ptr); ++i) { + if (ptr[i] != i) + ASSERT_EQ(ptr[i], i); + } if (!before) { new_ptr = mremap((void *)map, size, size, flags, @@ -2321,8 +2325,10 @@ TEST_F(hmm, migrate_remap_fault) /* Fault pages back to system memory and check them. */ for (i = 0, ptr = buffer->ptr; - i < size / sizeof(*ptr); ++i) - ASSERT_EQ(ptr[i], i); + i < size / sizeof(*ptr); ++i) { + if (ptr[i] != i) + ASSERT_EQ(ptr[i], i); + } munmap(new_ptr, size); buffer->ptr = old_ptr; _ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] selftests/mm: hmm: give migrate_remap_fault a longer timeout 2026-11-25 5:37 ` Andrew Morton @ 2026-11-25 5:50 ` Balbir Singh 2026-11-25 5:57 ` Andrew Morton 2026-11-25 9:22 ` Zenghui Yu 1 sibling, 1 reply; 7+ messages in thread From: Balbir Singh @ 2026-11-25 5:50 UTC (permalink / raw) To: Andrew Morton Cc: Alistair Popple, Zenghui Yu, linux-mm, jgg, leon, david, liam, vbabka, rppt, mhocko On Tue, Nov 24, 2026 at 09:37:30PM -0800, Andrew Morton wrote: > On Fri, 20 Nov 2026 09:31:23 +1100 Alistair Popple <apopple@nvidia.com> wrote: > > > On 2026-11-20 at 00:39 +1100, Zenghui Yu <zenghui.yu@linux.dev> wrote... > > > From: "Zenghui Yu (Huawei)" <zenghui.yu@linux.dev> > > > > > > migrate_remap_fault sizes its working set from the PMD page size and runs > > > 24 combinations of migration/mremap parameters. On arm64 with 64K base > > > pages the PMD size is 512MB, so the test churns through tens of gigabytes > > > of memory and takes ~32 seconds on my test machine. This just exceeds the > > > kselftest harness's 30s default per-test timeout (TEST_TIMEOUT_DEFAULT), > > > and the test gets killed with "Test terminated by timeout" even though it > > > is making steady progress. > > > > > > Raise the timeout to 120 seconds via TEST_F_TIMEOUT, so that the test can > > > run to completion on configurations with large PMD sizes. > > > > I guess the alternative is to reduce the number of test combinations, but that > > seems like it would reduce coverage so this seems reasonable. Adding Balbir to > > CC in case he has thoughts though. > > 32 seconds is just too long. We have ~1200 seltests! Imagine if they > all did that. > > Can we figure out how to make this test a lot faster? I slop-coded a > thing (below) which halves the runtime but it still needs to be taught > to do at least one full-PMD MADV_NOHUGEPAGE run on systems with a PMD > larger than 2 MiB. And 15 seconds still sucks. > > See, if running all selftest takes multiple hours then lots of people > just aren't going to run selftests and that harms our overall project. > They need to be snappy. > > If we can't do this then I suggest we find a general way of excluding > exceptionally slow tests from run_tests unless the user explicitly > passes some --i-am-very-patient arg. But that's out of scope for this > present timeout issue. > > Zenghui, are you able to figure out some way of speeding up hmm-tests.c > to avoid the timeout without compromising test coverage too much? > That's the delicate balance. The changes below look reasonable. I can move the perf testing out of hmm_tests into a separate test or trim the sizes to smaller set of huge page sizes Balbir > Thanks. > > > > --- a/tools/testing/selftests/mm/hmm-tests.c~selftests-mm-hmm-speed-up-migrate_remap_fault > +++ a/tools/testing/selftests/mm/hmm-tests.c > @@ -2250,7 +2250,8 @@ TEST_F(hmm, migrate_remap_fault) > { > struct hmm_buffer *buffer; > unsigned long npages; > - unsigned long size = pmd_psize(); > + unsigned long pmd_size = pmd_psize(); > + unsigned long size; > unsigned long offsets[3]; > unsigned long i; > void *old_ptr, *new_ptr = NULL; > @@ -2258,16 +2259,17 @@ TEST_F(hmm, migrate_remap_fault) > int *ptr; > int ret, j, use_thp, dont_unmap, before; > > - if (!size) > - size = TWOMEG; > - > - offsets[0] = 0; > - offsets[1] = size / 4; > - offsets[2] = size / 2; > + if (!pmd_size) > + pmd_size = TWOMEG; > > for (before = 0; before < 2; ++before) { > for (dont_unmap = 0; dont_unmap < 2; ++dont_unmap) { > for (use_thp = 0; use_thp < 2; ++use_thp) { > + /* Keep a full PMD for the huge-page cases. */ > + size = use_thp || pmd_size <= TWOMEG ? pmd_size : TWOMEG; > + offsets[0] = 0; > + offsets[1] = size / 4; > + offsets[2] = size / 2; > for (j = 0; j < ARRAY_SIZE(offsets); ++j) { > int flags = MREMAP_MAYMOVE | MREMAP_FIXED; > > @@ -2309,8 +2311,10 @@ TEST_F(hmm, migrate_remap_fault) > > /* Check what the device read. */ > for (i = 0, ptr = buffer->mirror; > - i < size / sizeof(*ptr); ++i) > - ASSERT_EQ(ptr[i], i); > + i < size / sizeof(*ptr); ++i) { > + if (ptr[i] != i) > + ASSERT_EQ(ptr[i], i); > + } > > if (!before) { > new_ptr = mremap((void *)map, size, size, flags, > @@ -2321,8 +2325,10 @@ TEST_F(hmm, migrate_remap_fault) > > /* Fault pages back to system memory and check them. */ > for (i = 0, ptr = buffer->ptr; > - i < size / sizeof(*ptr); ++i) > - ASSERT_EQ(ptr[i], i); > + i < size / sizeof(*ptr); ++i) { > + if (ptr[i] != i) > + ASSERT_EQ(ptr[i], i); > + } > > munmap(new_ptr, size); > buffer->ptr = old_ptr; > _ > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] selftests/mm: hmm: give migrate_remap_fault a longer timeout 2026-11-25 5:50 ` Balbir Singh @ 2026-11-25 5:57 ` Andrew Morton 0 siblings, 0 replies; 7+ messages in thread From: Andrew Morton @ 2026-11-25 5:57 UTC (permalink / raw) To: Balbir Singh Cc: Alistair Popple, Zenghui Yu, linux-mm, jgg, leon, david, liam, vbabka, rppt, mhocko On Wed, 25 Nov 2026 16:50:33 +1100 Balbir Singh <balbirs@nvidia.com> wrote: > > Zenghui, are you able to figure out some way of speeding up hmm-tests.c > > to avoid the timeout without compromising test coverage too much? > > > > That's the delicate balance. I think we should have tools/testing/stress-tests and tools/testing/performance-tests. Without those things, everything gets put into selftests/. > The changes below look reasonable. I can > move the perf testing out of hmm_tests into a separate test or trim the > sizes to smaller set of huge page sizes Great, thanks. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] selftests/mm: hmm: give migrate_remap_fault a longer timeout 2026-11-25 5:37 ` Andrew Morton 2026-11-25 5:50 ` Balbir Singh @ 2026-11-25 9:22 ` Zenghui Yu 1 sibling, 0 replies; 7+ messages in thread From: Zenghui Yu @ 2026-11-25 9:22 UTC (permalink / raw) To: Andrew Morton Cc: Alistair Popple, linux-mm, jgg, leon, david, liam, vbabka, rppt, mhocko, balbirs Hi Andrew, On 11/25/26 1:37 PM, Andrew Morton wrote: > On Fri, 20 Nov 2026 09:31:23 +1100 Alistair Popple <apopple@nvidia.com> wrote: > > > On 2026-11-20 at 00:39 +1100, Zenghui Yu <zenghui.yu@linux.dev> wrote... > > > From: "Zenghui Yu (Huawei)" <zenghui.yu@linux.dev> > > > > > > migrate_remap_fault sizes its working set from the PMD page size and runs > > > 24 combinations of migration/mremap parameters. On arm64 with 64K base > > > pages the PMD size is 512MB, so the test churns through tens of gigabytes > > > of memory and takes ~32 seconds on my test machine. This just exceeds the > > > kselftest harness's 30s default per-test timeout (TEST_TIMEOUT_DEFAULT), > > > and the test gets killed with "Test terminated by timeout" even though it > > > is making steady progress. > > > > > > Raise the timeout to 120 seconds via TEST_F_TIMEOUT, so that the test can > > > run to completion on configurations with large PMD sizes. > > > > I guess the alternative is to reduce the number of test combinations, but that > > seems like it would reduce coverage so this seems reasonable. Adding Balbir to > > CC in case he has thoughts though. > > 32 seconds is just too long. We have ~1200 seltests! Imagine if they > all did that. > > Can we figure out how to make this test a lot faster? I slop-coded a > thing (below) which halves the runtime but it still needs to be taught > to do at least one full-PMD MADV_NOHUGEPAGE run on systems with a PMD > larger than 2 MiB. And 15 seconds still sucks. > > See, if running all selftest takes multiple hours then lots of people > just aren't going to run selftests and that harms our overall project. > They need to be snappy. The good news is that it is perfect on the popular 4k-page-size (and 16k) systems, and 64k has not been tested much yet ;-) There are still some failures on my 64k machines that need to be addressed. I just haven't had a chance to fix them. > > If we can't do this then I suggest we find a general way of excluding > exceptionally slow tests from run_tests unless the user explicitly > passes some --i-am-very-patient arg. But that's out of scope for this > present timeout issue. > > Zenghui, are you able to figure out some way of speeding up hmm-tests.c > to avoid the timeout without compromising test coverage too much? Since Balbir volunteers to deal with it, I will test it then. Thanks both, Zenghui ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-11-25 9:23 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-19 13:39 [PATCH] selftests/mm: hmm: give migrate_remap_fault a longer timeout Zenghui Yu 2026-11-19 13:54 ` Zenghui Yu 2026-11-19 22:31 ` Alistair Popple 2026-11-25 5:37 ` Andrew Morton 2026-11-25 5:50 ` Balbir Singh 2026-11-25 5:57 ` Andrew Morton 2026-11-25 9:22 ` Zenghui Yu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox