What is an Unevictable LRU Infrastructure ?

RELATED TO Unevictable

The Unevictable LRU infrastructure addresses the following classes of
unevictable pages:

+ page owned by ram disks or ramfs
+ page mapped into SHM_LOCKed shared memory regions
+ page mapped into VM_LOCKED [mlock()ed] vmas
Least  Recently Used  (LRU): discards  the least  recently  used items first. This  algorithm requires
keeping  track of what was  used when, which  is expensive if  one wants  to make  sure the  algorithm
always discards the least recently used item. General implementations of this technique require  to keep
"age bits" for  cache-lines and  track the "Least  Recently   Used"  cache-line   based  on  age-bits.
In  such implementation, every time a cache-line  is used, the age of all other cache-lines changes.  LRU
is actually  a family of  caching algorithms with members including:  2Q by Theodore Johnson and  Dennis
Shasha and LRU/K by Pat O'Neil, Betty O'Neil and Gerhard Weikum.

Hugetlb pages are also  unevictable. Hugepages are already implemented in a way  that these pages don't
reside on the LRU and  hence are not iterated over during  the vmscan.  So there is no  need to move
around these pages  across different  LRU's. We just  account these  pages as unevictable for correct

The Unevictable LRU  adds an additional LRU list  to track unevictable pages and to hide these pages from
vmscan.  This mechanism is based on a patch  by Larry  Woodman of Red  Hat to address  several
scalability problems with page reclaim in  Linux.  The problems have been observed at  customer sites  on
large  memory x86_64  systems.  For  example, a non-numal x86_64 platform with 128GB  of main memory will
have over 32 million 4k  pages in a  single zone.  When  a large fraction  of these pages are not
evictable for  any reason [see below], vmscan will spend a lot of time scanning the LRU lists looking for
the small fraction of pages that  are evictable.  This can  result in a  situation where all cpus are 4
spending 100% of their time  in vmscan for hours  or days on end, with the system completely

$sudo cat /proc/meminfo | grep -A 5 -B 5 Unevictable
Inactive: 1591548 kB
Active(anon): 595404 kB
Inactive(anon): 502680 kB
Active(file): 1009628 kB
Inactive(file): 1088868 kB
Unevictable: 130612 kB
Mlocked: 80 kB
SwapTotal: 8075260 kB
SwapFree: 8074736 kB
Dirty: 260 kB
Writeback: 0 kB



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s