Skip to content

DO NOT MERGE: SubPage Impl for Review

Until now, PAGE_SHIFT, PAGE_SIZE and PAGE_MASK have defined the page size (either 4KB, 16KB or 64KB) that is used both by the kernel (for memory allocation, fault handling, etc) and by the hardware translation tables.

This change separates these quantities so that PAGE_SHIFT, PAGE_SIZE and PAGE_MASK are all used for the kernel's purposes, and new macros, SUBPAGE_SHIFT, SUBPAGE_SIZE and SUBPAGE_MASK are all used for the hardware tanslation tables. Although they have the same value at the moment, the intention is that a future commit will allow these values to be different. This will allow (for example) a kernel to use 16KB granules but for those 16KB granules to be represented in the hardware as 4 contiguous 4KB ptes. This is achieved by reducing the number of PTRS_PER_PTE that the kernel sees and a single kernel pte becomes multiple contiguous hw ptes ("sub-ptes").

Why is this useful? In the short term, it allows us to separate and measure the performance impacts due to TLB pressure and kernel bookkeeping structures. In the longer term, it provides the possibility for a number of memory and performance improvements.

This initial commit introduces the new macros and updates the arch code to use them appropriately. Both sets of macros have the same values for now, so no behavioural changes are intended.

Signed-off-by: Ryan Roberts

Merge request reports