Skip to content

Commit

Permalink
feat: mm: page poison debugging and assertion enhancements
Browse files Browse the repository at this point in the history
This commit introduces a page poison debugging mechanism and additional
assertions for memory management, improving system maintainability and
debugging capabilities. The changes aim to detect illegal memory usage
early and provide better clarity in managing page allocations.

Changes:
- Added `RT_DEBUGGING_PAGE_POISON` option to enable memory usage tracing.
- Introduced a page poisoner for detecting illegal memory usage.
- Implemented region-based memory tracking using bitmaps.
- Enhanced spinlock protection for memory management operations.
- Fixed several assertion checks for memory safety.
- Renamed macros for consistency (`FLOOR` to `CEIL`).
- Refined memory allocation and deallocation logic to include poisoning.
- Updated Kconfig to add configurable `RT_PAGE_MAX_ORDER` and poison debugging.
- Improved debugging outputs for page regions and memory operations.

Signed-off-by: Shell <[email protected]>
  • Loading branch information
polarvid committed Dec 3, 2024
1 parent d835f95 commit 8fe9e51
Show file tree
Hide file tree
Showing 4 changed files with 247 additions and 80 deletions.
15 changes: 15 additions & 0 deletions components/mm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ config RT_PAGE_AFFINITY_BLOCK_SIZE
It should be set to `1ul << ((index + block) - page_offset)` in this case.
You could also exploit this as a tunning for cache coloring.

config RT_PAGE_MAX_ORDER
int "Max order of pages allocatable by page allocator"
default 11
depends on ARCH_MM_MMU
help
For example, A value of 11 means the maximum chunk of contiguous memory
allocatable by page system is 2^(11 + ARCH_PAGE_BITS - 1) Bytes.
Large memory requirement can consume all system resource, and should
consider reserved memory instead to enhance system endurance.
Max order should at least satisfied usage by huge page.

config RT_USING_MEMBLOCK
bool "Using memblock"
default n
Expand All @@ -28,4 +39,8 @@ config RT_DEBUGGING_ALIASING
bool "Using aliasing paging debugger"
default n

config RT_DEBUGGING_PAGE_POISON
bool "Using page poisoner to detect illegal usage"
default n

endmenu
Loading

0 comments on commit 8fe9e51

Please sign in to comment.