zephyr/doc/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
..
data_structures doc: Fix double 'the' 2023-11-15 14:25:11 +00:00
drivers doc/kernel/drivers: Mention deferred initialization 2024-05-10 20:24:44 -04:00
iterable_sections doc: move misc services into OS Service section 2022-04-07 16:35:19 +02:00
memory_management kernel: mmu: shrink and align struct z_page_frame 2024-05-13 16:04:40 -04:00
object_cores doc: Add missing threads references to object cores 2023-10-09 10:16:46 +02:00
services Documentation: Update Polling API 2024-05-07 09:32:13 +02:00
timing_functions os: timing: polish doxygen 2023-12-12 19:10:33 +01:00
usermode syscall: rename Z_OOPS -> K_OOPS 2023-11-03 11:46:52 +01:00
util doc: move utility functions to kernel 2022-04-07 16:35:19 +02:00
code-relocation.rst doc: kernel: code-relocation: Remove kernel example and add tips 2024-05-02 09:56:11 +01:00
index.rst doc: Add object core documentation 2023-09-30 08:04:14 +03:00
timeutil.rst bluetooth: mesh: Doc fix Bluetooth mesh to Mesh 2023-12-01 10:56:18 +00:00