Revert "kernel: add z_num_pagefaults_get()"
This reverts commit d7e6bc3e84d753e247604268bc33cf455e396d2e.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
diff --git a/kernel/include/mmu.h b/kernel/include/mmu.h
index 00d9579..a2a0300 100644
--- a/kernel/include/mmu.h
+++ b/kernel/include/mmu.h
@@ -356,16 +356,6 @@
*/
/**
- * Number of page faults since system startup
- *
- * Counts only those page faults that were handled successfully by the demand
- * paging mechanism and were not errors.
- *
- * @return Number of successful page faults
- */
-unsigned long z_num_pagefaults_get(void);
-
-/**
* Free a page frame physical address by evicting its contents
*
* The indicated page frame, if it contains a data page, will have that
diff --git a/kernel/mmu.c b/kernel/mmu.c
index 15defbf..c1c8826 100644
--- a/kernel/mmu.c
+++ b/kernel/mmu.c
@@ -564,8 +564,6 @@
}
#ifdef CONFIG_DEMAND_PAGING
-static unsigned long z_num_pagefaults;
-
/* Current implementation relies on interrupt locking to any prevent page table
* access, which falls over if other CPUs are active. Addressing this is not
* as simple as using spinlocks as regular memory reads/writes constitute
@@ -946,30 +944,7 @@
bool z_page_fault(void *addr)
{
- bool ret;
-
- ret = do_page_fault(addr, false);
- if (ret) {
- /* Wasn't an error, increment page fault count */
- int key;
-
- key = irq_lock();
- z_num_pagefaults++;
- irq_unlock(key);
- }
- return ret;
-}
-
-unsigned long z_num_pagefaults_get(void)
-{
- unsigned long ret;
- int key;
-
- key = irq_lock();
- ret = z_num_pagefaults;
- irq_unlock(key);
-
- return ret;
+ return do_page_fault(addr, false);
}
static void do_mem_unpin(void *addr)
diff --git a/tests/kernel/mem_protect/demand_paging/src/main.c b/tests/kernel/mem_protect/demand_paging/src/main.c
index 4440671..3a692c3 100644
--- a/tests/kernel/mem_protect/demand_paging/src/main.c
+++ b/tests/kernel/mem_protect/demand_paging/src/main.c
@@ -40,11 +40,8 @@
void test_touch_anon_pages(void)
{
- unsigned long faults;
static const char *nums = "0123456789";
- faults = z_num_pagefaults_get();
-
printk("checking zeroes\n");
/* The mapped area should have started out zeroed. Check this. */
for (size_t i = 0; i < arena_size; i++) {
@@ -66,12 +63,6 @@
"arena corrupted at index %d (%p): got 0x%hhx expected 0x%hhx",
i, &arena[i], arena[i], nums[i % 10]);
}
-
- faults = z_num_pagefaults_get() - faults;
-
- /* Specific number depends on how much RAM we have but shouldn't be 0 */
- zassert_not_equal(faults, 0UL, "no page faults handled?");
- printk("Kernel handled %lu page faults\n", faults);
}
/* ztest main entry*/