list_lru Optimizations for UEK7 U1

April 19, 2023 | 2 minute read
Text Size 100%:

The Oracle Linux team has incorporated a major memory-saving feature into the UEK7 U1 release. The Linux kernel utilizes a least-recently-used list (list_lru) to track inodes and dentries. The list_lru grows proportionally with the number of memory cgroups on the system. On systems running a large number of containers, the list_lru can consume gigabytes of RAM.

For UEK7 U1, Kamalesh Babulal backported an upstream patchset [1] that improves the list_lru behavior. The list_lru tracks every memcg struct on every superblock, and in previous releases this information was made available to every memory cgroup – whether it was needed it or not. Many containers don’t utilize this information, and thus, this memory is often wasted. This patchset modifies the list_lru logic to delay the availability of the list_lru in the cgroup until the first time it’s needed.

To highlight the significance of this patchset, we ran a simple test on a 32-cpu Intel Xen machine with 188G of RAM. We sequentially created and deleted 400 lxc containers.

kmalloc-32 object count

 
Prior to test start
During test
After test
UEK7 (prior to this patchset)
23,424
7,236,608
583,296
UEK7 (with this patchset)
11,392
82,944
82,080

 

For the above example, this patchset reduced the number of kmalloc-32 objects from 7.2 million down to approximately 83,000, a savings of ~227 MB and roughly 87x fewer kmalloc-32 objects!

The list_lru improvement is available and always on in the UEK7 U1 kernel.

[1] https://lore.kernel.org/linux-mm/20211220085649.8196-1-songmuchun@bytedance.com/

Tom Hromatka


Previous Post

Hands-On Training with Luna Labs

Craig McBride | 1 min read

Next Post


New Oracle Linux developer preview releases now available

Simon Coter | 2 min read