If this question depends on the linux distribution, please answer it in a "general way" (i.e. the most common implementation on linux distributions).

In the page table of a process we can find the physical direction where the page we are looking for is mapped in main memory or a pointer to disk if the page we are looking for isn't present in main memory and we have to catch it from the disk. But my question is: if the page we are looking for is placed in the swap area, what will we find on the page table of that process? We will find a pointer to disk (but pointing to the page in the swap area) or will we find a physical direction but being this physical direction a "virtual direction" which makes mainMemory + swapArea a unified memory (i.e. if we have 16GB main memory + 2GB swap memory we can see in the page table that the page we are looking for is in the direction X (being X a direction that corresponds to 17GB) and this mean that we will find it in the swap memory (because is >16GB the direction)) ? Remember that we are suposing 16GB main memory + 2GB swap memory.

1 Answer 1


The page table entry for a page which is swapped out contains bits to indicate that fact (at least one; the details depend on the architecture), and a two-part pointer to the information describing the swapped page. Each swap device or file has a corresponding swap_info structure, and each of those has a map which links a page table entry to a location in the swap device or file.

See How does the kernel address swapped memory pages on swap partition\file? and the “Swap Management” chapter of Mel Gorman’s Understanding the Linux Virtual Memory Manager for details.

  • When you say "depend on the architecture" you mean that depends on the exact implementation of the kernel? Or literally on the microprocessor's architecture? And what is a "two-part pointer"?
    – isma
    Jun 30, 2020 at 21:13
  • I mean it depends on the hardware architecture. The swap pointer is in two parts: the first is an index to find the target swap device or file, the second an offset in the swap map. Jul 1, 2020 at 6:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .