From bf287c6e2b25397d9d327a0784e8163ce45d8ea5 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Mon, 26 Apr 2021 13:44:08 -0700 Subject: [PATCH] tests: mem_protect/demand_paging: wait a bit for NRU to work This waits a bit for NRU eviction algorithm (which is the default) to work its magic to clear the access bit of physical frames. This increases the number of clean pages which can be evicted, to make sure the number of clean pages evicted is not zero, which would cause an assertion. Signed-off-by: Daniel Leung --- tests/kernel/mem_protect/demand_paging/src/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/kernel/mem_protect/demand_paging/src/main.c b/tests/kernel/mem_protect/demand_paging/src/main.c index 1e3c5b074aa..e26938f9d2e 100644 --- a/tests/kernel/mem_protect/demand_paging/src/main.c +++ b/tests/kernel/mem_protect/demand_paging/src/main.c @@ -149,6 +149,10 @@ void test_touch_anon_pages(void) zassert_not_equal(stats.eviction.dirty, 0UL, "there should be dirty pages being evicted."); +#ifdef CONFIG_EVICTION_NRU + k_msleep(CONFIG_EVICTION_NRU_PERIOD * 2); +#endif /* CONFIG_EVICTION_NRU */ + /* There should be some clean pages to be evicted now, * since the arena is not modified. */