enable multi-gen LRU by default

Bug #2023629 reported by Andrea Righi
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Fix Released
Wishlist
Unassigned
Mantic
Fix Released
Wishlist
Unassigned

Bug Description

[Impact]

Kernels >= 6.1 have the option to use an alternative least-recently-used (LRU) page reclaiming mechanism, called multi-gen LRU (MGLRU) [1].

In short: the kernel used to maintain two LRU lists of "touched" pages: the "active" and "inactive" list. The former contains pages thought to be likely used in the future (working set), while the latter contains pages thought to be less likely used and therefore likely to be reclaimed when needed. Pages accessed more frequently are moved to the active list, while pages accessed less frequently are moved to the inactive list.

The MGLRU generalizes this concept into multiple generations, instead of just using two lists. Pages move from older to newer generations when they are accessed and pages from older generations are reclaimed first when memory is needed. Generations age over time with new generations being created as the oldest ones are fully reclaimed.

Fedora [2] and Archlinux [3] both have MGLRU enabled by default and there are plans to enable this also in Debian and openSUSE.

We should also consider to enable this option across the board for Mantic, considering that in the future MGLRU is likely to become the default page reclaiming policy in the kernel.

[1] https://lwn.net/Articles/856931/
[2] https://koji.fedoraproject.org/koji/buildinfo?buildID=2168435
[3] https://archlinux.org/packages/core/x86_64/linux-lts/

[Test case]

Apache, MariaDB, memcached, MongoDB, PostreSQL, Redis benchmarks can all show a performance improvement in terms of operations per sec switching to MGLRU.

[Fix]

Set CONFIG_LRU_GEN_ENABLED=y in config/annotations.

[Regression potential]

This change is going to affect the page reclaiming policy in the kernel, so a lot of workloads can be potentially affected by this change. We may experience *performance regressions* especially in those systems that are running memory intensive workloads or doing large amount of I/O (page cache being stressed and lots of page reclaiming events are happening in the system).

However, considering the benefits of this change, especially in the cloud/server-oriented scenario, and also considering that this option is likely to become the "default" page reclaiming mechanism in the kernel, it makes sense to start using it now so that we can catch potential regressions in advance and act accordingly.

Moreover, this option can still be adjusted at run-time via /sys/kernel/mm/lru_gen/enabled, so it's very easy to mitigate any potential regression and rollback to the old behavior if needed.

Andrea Righi (arighi)
description: updated
description: updated
description: updated
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. While running an Ubuntu kernel (not a mainline or third-party kernel) please enter the following command in a terminal window:

apport-collect 2023629

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Andrea Righi (arighi)
description: updated
Changed in linux (Ubuntu Mantic):
status: Incomplete → Confirmed
importance: Undecided → Wishlist
Andrea Righi (arighi)
description: updated
description: updated
Andrea Righi (arighi)
description: updated
description: updated
description: updated
description: updated
description: updated
description: updated
Andrea Righi (arighi)
description: updated
description: updated
description: updated
Andrea Righi (arighi)
Changed in linux (Ubuntu Mantic):
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package linux - 6.5.0-5.5

---------------
linux (6.5.0-5.5) mantic; urgency=medium

  * mantic/linux: 6.5.0-5.5 -proposed tracker (LP: #2034546)

  * Packaging resync (LP: #1786013)
    - [Packaging] update helper scripts
    - debian/dkms-versions -- update from kernel-versions (main/d2023.08.23)

 -- Andrea Righi <email address hidden> Wed, 06 Sep 2023 15:51:04 +0200

Changed in linux (Ubuntu Mantic):
status: Fix Committed → Fix Released
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote :

This bug is awaiting verification that the linux-azure-6.5/6.5.0-1007.7~22.04.1 kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-jammy-linux-azure-6.5' to 'verification-done-jammy-linux-azure-6.5'. If the problem still exists, change the tag 'verification-needed-jammy-linux-azure-6.5' to 'verification-failed-jammy-linux-azure-6.5'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

tags: added: kernel-spammed-jammy-linux-azure-6.5-v2 verification-needed-jammy-linux-azure-6.5
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote :

This bug is awaiting verification that the linux-aws-6.5/6.5.0-1008.8~22.04.1 kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-jammy-linux-aws-6.5' to 'verification-done-jammy-linux-aws-6.5'. If the problem still exists, change the tag 'verification-needed-jammy-linux-aws-6.5' to 'verification-failed-jammy-linux-aws-6.5'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

tags: added: kernel-spammed-jammy-linux-aws-6.5-v2 verification-needed-jammy-linux-aws-6.5
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.