You copied the Doc URL to your clipboard.

OS use of translation table descriptors

Operating systems use an access flag bit to keep track of which pages are being used. Software manages the flag. When the page is first created, its entry has AF set to 0. The first time the page is accessed by code, if it has AF at 0, this triggers an MMU fault. The Page fault handler records that this page is now being used and manually sets the AF bit in the table entry.

For example, the Linux kernel uses the [AF] bit for PTE_AF on ARM64 (the Linux kernel name for AArch64), which is used to check whether a page has ever been accessed. This influences some of the kernel memory management choices. For example, when a page must be swapped out of memory, it is less likely to swap out pages that are being actively used.

descriptors.png

The following figure shows how memory attributes are specified in a stage 1 block entry.

block_entries.png

A memory attribute bit in the descriptor, the Access Flag (AF), indicates when a block entry is used for the first time.

  • AF = 0: This block entry has not yet been used.
  • AF = 1: This block entry has been used.

Bits [58:55] of the descriptor are marked as reserved for Software Use and can be used to record OS-specific information in the translation tables. For example, the Linux kernel uses one of these bits to mark an entry as clean or dirty. The dirty status records whether the page has been written to. If the page is later swapped out of memory, a clean page can simply be discarded, but a dirty page must have its contents saved first.

Was this page helpful? Yes No