zephyr/kernel/include
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
..
gen_offset.h kernel: migrate includes to <zephyr/...> 2022-05-09 09:26:20 +02:00
ipi.h kernel: split timeslicing/ipi code out of sched.c 2024-04-01 18:47:36 -04:00
kernel_arch_interface.h kernel: add closing comments to config endifs 2024-03-25 18:03:31 -04:00
kernel_internal.h coding guidelines: comply with MISRA Rule 20.9 2024-05-01 19:48:19 +01:00
kernel_offsets.h kernel: add closing comments to config endifs 2024-03-25 18:03:31 -04:00
kernel_tls.h linker: Round TLS sizes up in linker script 2024-02-25 22:28:56 -05:00
ksched.h coding guidelines: comply with MISRA Rule 12.1. 2024-05-12 13:37:27 -04:00
kswap.h kernel: add closing comments to config endifs 2024-03-25 18:03:31 -04:00
kthread.h coding guidelines: comply with MISRA Rule 20.9 2024-05-01 19:48:19 +01:00
mmu.h kernel: mmu: shrink and align struct z_page_frame 2024-05-13 16:04:40 -04:00
offsets_short.h kernel: Remove unused derived offset symbols 2023-02-22 16:01:32 +01:00
priority_q.h kernel: priority queues: declare as static inlines 2024-04-22 16:40:11 -04:00
timeout_q.h kernel: add closing comments to config endifs 2024-03-25 18:03:31 -04:00
wait_q.h kernel: move priority queue handling to own file/header 2024-03-02 15:06:45 +01:00