One of the fundamental design decisions of the Linux kernel is that caches are usually never fixed in size, but can grow dynamically until all available RAM is used. You have seen in this chapter that filling RAM with information is a good thing because unused memory is a wasted resource, but that the kernel needs to use a mechanism that allows for shrinking caches if memory is required for more urgent tasks. You have been introduced to the mechanisms employed to judge whether pages are actively used or not. This allows for evicting rarely used pages from memory, and depending on how the pages are used, they can be discarded, synchronized, or swapped out. The last point implements the inverse of caching: A block device can be used to extend the effectively available amount of memory at the cost of access speed.

The kernel uses two mechanisms to reclaim memory: A periodic daemon consistently monitors memory usage and tries to keep the most active pages in RAM, but there are also routines that handle acute memory pressure.

While page reclaim and swapping work on page-sized objects, the kernel also provides mechanisms to shrink caches with smaller objects, and you have been introduced to the corresponding routines at the end of this chapter.

Continue reading here: Auditing

Was this article helpful?

0 0