• Immutable Page
  • Info
  • Attachments

LRU

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.

Tell others about this page:

last edited 2006-09-12 19:08:38 by p54A0186E