LinuxMM:

LRU is Least Recently Used

The following is my current understanding of Linux' LRU implementation, which may be full misleading, full of typos, incorrect, all three or by a very slim chance even useful. Beware!

Most pages are covered by LRU. Exceptions currently include all slab caches. Some slab caches, notably the dentry cache and the various inode caches, tend to grow. Without opposing force, they would occupy all available memory over time. The opposing force comes in the form of "shrinker" calls that free objects from these caches. Balance between regular LRU operations and shrinker calls is magic.

LRU pages belong to one of two linked list, the "active" and the "inactive" list. Page movement is driven by memory pressure. Pages are taken from the end of the inactive list to be freed. If the page has the reference bit set, it is moved to the beginning of the active list and the reference bit is cleared. If the page is dirty, writeback is commenced and the page is moved to the beginning of the inactive list. If the page is unreferenced and clean, it can be reused.

LinuxMM: LRU (last edited 2017-12-30 01:05:11 by localhost)