zephyr/kernel
Nicolas Pitre e9a47d932c kernel: mmu: shrink and align struct z_page_frame
The struct z_page_frame is marked __packed to avoid extra padding as
such padding may represent significant memory waste when lots of page
frames are used. However this is a bad strategy.

The code contained this somewhat dubious comment and code in
free_page_frame_list_put():

	/* The structure is packed, which ensures that this is true */
	void *node = pf;
	sys_slist_append(&free_page_frame_list, node);

This is bad for many reasons:

- type checking is completely bypassed;

- if the sys_snode_t node member is no longer located at the front of
  struct z_page_frame then the code will still compile and possibly run
  but be broken with memory corruption as a likely outcome;

- the sys_slist_append() code is completely unaware of the packed
  attribute which breaks architectures with alignment restrictions.

Let's improve code efficiency as well as memory usage by removing the
packed attribute and manually packing the flags in the unused virtual
address bits. This way the page frame array remains naturally aligned,
data access becomes optimal and the actual array size gets even smaller.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2024-05-13 16:04:40 -04:00
..
include kernel: mmu: shrink and align struct z_page_frame 2024-05-13 16:04:40 -04:00
paging
CMakeLists.txt kernel: move nothread support to own file 2024-04-06 14:22:08 +03:00
Kconfig linker: decouple KERNEL_WHOLE_ARCHIVE from LLEXT 2024-05-13 14:23:38 +02:00
Kconfig.device
Kconfig.obj_core
Kconfig.smp
Kconfig.vm
atomic_c.c
banner.c kernel: banner: use BUILD_VERSION only if not empty 2024-04-04 23:47:33 +02:00
busy_wait.c
compiler_stack_protect.c
condvar.c
cpu_mask.c
device.c coding guidelines: comply with MISRA Rule 11.8 2024-05-10 14:45:14 -05:00
dynamic.c
dynamic_disabled.c
errno.c
events.c
fatal.c
float.c
futex.c coding guidelines: comply with MISRA Rule 12.1. 2024-05-12 13:37:27 -04:00
idle.c
init.c sched: Optimize dummy thread usage on SMP 2024-05-02 13:55:03 -04:00
ipi.c kernel: rename sliceable -> thread_is_sliceable 2024-04-01 18:47:36 -04:00
irq_offload.c
kheap.c coding guidelines: comply with MISRA Rule 12.1. 2024-05-12 13:37:27 -04:00
mailbox.c kernel: Clean up mailbox async msg configuration 2024-04-09 11:05:55 +02:00
main_weak.c
mem_domain.c coding guidelines: comply with MISRA Rule 12.1. 2024-05-12 13:37:27 -04:00
mem_slab.c coding guidelines: comply with MISRA Rule 12.1. 2024-05-12 13:37:27 -04:00
mempool.c
mmu.c kernel: mmu: shrink and align struct z_page_frame 2024-05-13 16:04:40 -04:00
msg_q.c coding guidelines: comply with MISRA Rule 21.15 2024-05-01 10:52:43 -04:00
mutex.c
nothread.c kernel: move nothread support to own file 2024-04-06 14:22:08 +03:00
obj_core.c
pipes.c coding guidelines: comply with MISRA Rule 12.1. 2024-05-12 13:37:27 -04:00
poll.c
priority_queues.c kernel: priority queues: declare as static inlines 2024-04-22 16:40:11 -04:00
queue.c coding guidelines: comply with MISRA Rule 12.1. 2024-05-12 13:37:27 -04:00
sched.c coding guidelines: comply with MISRA Rule 12.1. 2024-05-12 13:37:27 -04:00
sem.c coding guidelines: comply with MISRA Rule 11.8 2024-05-10 14:45:14 -05:00
smp.c sched: Optimize dummy thread usage on SMP 2024-05-02 13:55:03 -04:00
spinlock_validate.c kernel/spinlock: Fix SPIN_VALIDATE in ISRs 2024-05-02 13:55:03 -04:00
stack.c coding guidelines: comply with MISRA Rule 11.8 2024-05-10 14:45:14 -05:00
system_work_q.c kernel: system_work_q: Mark queue thread as essential 2024-04-25 21:40:24 +02:00
thread.c coding guidelines: comply with MISRA Rule 12.1. 2024-05-12 13:37:27 -04:00
thread_monitor.c
timeout.c coding guidelines: comply with MISRA Rule 12.1. 2024-05-12 13:37:27 -04:00
timer.c
timeslicing.c kernel: timeslicing: add time slice reset in slice per thread api 2024-05-01 22:55:50 +01:00
usage.c kernel: Remove duplicate execution_cycles write and improve docstring 2024-04-28 13:04:20 -04:00
userspace.c coding guidelines: comply with MISRA Rule 12.1. 2024-05-12 13:37:27 -04:00
userspace_handler.c coding guidelines: comply with MISRA Rule 11.8 2024-05-10 14:45:14 -05:00
version.c
work.c coding guidelines: comply with MISRA Rule 2.2 2024-05-02 09:32:46 +01:00
xip.c