Data Structures

As usual, the description begins with a presentation of the central data structures that form the backbone of implementation and hold all the information and data needed by the kernel. The cornerstone of swap area management is the swap_info array defined in mm/swap-info.c; its entries store information on the individual swap areas in the system1 :

mm/swapfile.c struct swap_info_struct swap_info[MAX_SWAPFILES];

The number of elements is defined statically in max_swapfiles at compilation time. The constant is normally defined as 25 = 32.

The kernel uses the term swap file to refer not only to swap files but also to swap partitions; the array therefore includes both types. As normally only one swap file is used, the limitation to a specific number is of no relevance. Neither does this number impose any kind of restriction on numerical calculations or other memory-intensive programs because, depending on architecture, swap areas may now have sizes in the gigabyte range. The restriction to 128 MiB in older versions no longer applies.

Continue reading here: Characterization of Swap Areas

Was this article helpful?

0 0