kernel: mm: only include demand_paging.h if needed

This moves including of demand_paging.h out of kernel/mm.h,
so that users of demand paging APIs must include the header
explicitly. Since the main user is kernel itself, we can be
more discipline about header inclusion.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2023-11-21 15:04:02 -08:00 committed by Carles Cufí
parent 062fc2242a
commit 40ba4015e3
10 changed files with 19 additions and 3 deletions

View file

@ -11,6 +11,10 @@
#include <ksched.h> #include <ksched.h>
#include <x86_mmu.h> #include <x86_mmu.h>
#ifdef CONFIG_DEMAND_PAGING
#include <zephyr/kernel/mm/demand_paging.h>
#endif
#ifndef CONFIG_X86_KPTI #ifndef CONFIG_X86_KPTI
/* Update the to the incoming thread's page table, and update the location of /* Update the to the incoming thread's page table, and update the location of
* the privilege elevation stack. * the privilege elevation stack.

View file

@ -14,7 +14,6 @@
#endif #endif
#include <zephyr/kernel/internal/mm.h> #include <zephyr/kernel/internal/mm.h>
#include <zephyr/kernel/mm/demand_paging.h>
/** /**
* @brief Kernel Memory Management * @brief Kernel Memory Management

View file

@ -8,7 +8,7 @@
#define ZEPHYR_INCLUDE_KERNEL_THREAD_H_ #define ZEPHYR_INCLUDE_KERNEL_THREAD_H_
#ifdef CONFIG_DEMAND_PAGING_THREAD_STATS #ifdef CONFIG_DEMAND_PAGING_THREAD_STATS
#include <zephyr/kernel/mm.h> #include <zephyr/kernel/mm/demand_paging.h>
#endif #endif
#include <zephyr/kernel/stats.h> #include <zephyr/kernel/stats.h>

View file

@ -20,6 +20,10 @@
#include <zephyr/logging/log.h> #include <zephyr/logging/log.h>
LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL); LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL);
#ifdef CONFIG_DEMAND_PAGING
#include <zephyr/kernel/mm/demand_paging.h>
#endif
/* /*
* General terminology: * General terminology:
* - A page frame is a page-sized physical memory region in RAM. It is a * - A page frame is a page-sized physical memory region in RAM. It is a

View file

@ -8,7 +8,7 @@
#include <kernel_internal.h> #include <kernel_internal.h>
#include <zephyr/internal/syscall_handler.h> #include <zephyr/internal/syscall_handler.h>
#include <zephyr/toolchain.h> #include <zephyr/toolchain.h>
#include <zephyr/kernel/mm.h> #include <zephyr/kernel/mm/demand_paging.h>
extern struct k_mem_paging_stats_t paging_stats; extern struct k_mem_paging_stats_t paging_stats;

View file

@ -20,6 +20,7 @@
#include <kernel_arch_interface.h> #include <kernel_arch_interface.h>
#include <zephyr/linker/linker-defs.h> #include <zephyr/linker/linker-defs.h>
#include <zephyr/sys/util.h> #include <zephyr/sys/util.h>
#include <zephyr/kernel/mm/demand_paging.h>
void *location_to_flash(uintptr_t location) void *location_to_flash(uintptr_t location)
{ {

View file

@ -8,6 +8,7 @@
#include <mmu.h> #include <mmu.h>
#include <string.h> #include <string.h>
#include <kernel_arch_interface.h> #include <kernel_arch_interface.h>
#include <zephyr/kernel/mm/demand_paging.h>
/* /*
* TODO: * TODO:

View file

@ -10,6 +10,8 @@
#include <kernel_arch_interface.h> #include <kernel_arch_interface.h>
#include <zephyr/init.h> #include <zephyr/init.h>
#include <zephyr/kernel/mm/demand_paging.h>
/* The accessed and dirty states of each page frame are used to create /* The accessed and dirty states of each page frame are used to create
* a hierarchy with a numerical value. When evicting a page, try to evict * a hierarchy with a numerical value. When evicting a page, try to evict
* page with the highest value (we prefer clean, not accessed pages). * page with the highest value (we prefer clean, not accessed pages).

View file

@ -18,6 +18,10 @@
#include "test_syscalls.h" #include "test_syscalls.h"
#endif #endif
#if defined(CONFIG_DEMAND_PAGING)
#include <zephyr/kernel/mm/demand_paging.h>
#endif
#if defined(CONFIG_X86) && defined(CONFIG_X86_MMU) #if defined(CONFIG_X86) && defined(CONFIG_X86_MMU)
#define STACKSIZE (8192) #define STACKSIZE (8192)
#else #else

View file

@ -6,6 +6,7 @@
#include <zephyr/ztest.h> #include <zephyr/ztest.h>
#include <zephyr/kernel/mm.h> #include <zephyr/kernel/mm.h>
#include <zephyr/kernel/mm/demand_paging.h>
#include <zephyr/timing/timing.h> #include <zephyr/timing/timing.h>
#include <mmu.h> #include <mmu.h>
#include <zephyr/linker/sections.h> #include <zephyr/linker/sections.h>