Documentation/admin-guide/mm/damon/lru_sort.rst

Source file repositories/reference/linux-study-clean/Documentation/admin-guide/mm/damon/lru_sort.rst

File Facts

System
Linux kernel
Corpus path
Documentation/admin-guide/mm/damon/lru_sort.rst
Extension
.rst
Size
13315 bytes
Lines
369
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

.. SPDX-License-Identifier: GPL-2.0

=============================
DAMON-based LRU-lists Sorting
=============================

DAMON-based LRU-lists Sorting (DAMON_LRU_SORT) is a static kernel module that
aimed to be used for proactive and lightweight data access pattern based
(de)prioritization of pages on their LRU-lists for making LRU-lists a more
trusworthy data access pattern source.

Where Proactive LRU-lists Sorting is Required?
==============================================

As page-granularity access checking overhead could be significant on huge
systems, LRU lists are normally not proactively sorted but partially and
reactively sorted for special events including specific user requests, system
calls and memory pressure.  As a result, LRU lists are sometimes not so
perfectly prepared to be used as a trustworthy access pattern source for some
situations including reclamation target pages selection under sudden memory
pressure.

Because DAMON can identify access patterns of best-effort accuracy while
inducing only user-specified range of overhead, proactively running
DAMON_LRU_SORT could be helpful for making LRU lists more trustworthy access
pattern source with low and controlled overhead.

How It Works?
=============

DAMON_LRU_SORT finds hot pages (pages of memory regions that showing access
rates that higher than a user-specified threshold) and cold pages (pages of
memory regions that showing no access for a time that longer than a
user-specified threshold) using DAMON, and prioritizes hot pages while
deprioritizing cold pages on their LRU-lists.  To avoid it consuming too much
CPU for the prioritizations, a CPU time usage limit can be configured.  Under
the limit, it prioritizes and deprioritizes more hot and cold pages first,
respectively.  System administrators can also configure under what situation
this scheme should automatically activated and deactivated with three memory
pressure watermarks.

Its default parameters for hotness/coldness thresholds and CPU quota limit are
conservatively chosen.  That is, the module under its default parameters could
be widely used without harm for common situations while providing a level of
benefits for systems having clear hot/cold access patterns under memory
pressure while consuming only a limited small portion of CPU time.

Interface: Module Parameters
============================

To use this feature, you should first ensure your system is running on a kernel
that is built with ``CONFIG_DAMON_LRU_SORT=y``.

To let sysadmins enable or disable it and tune for the given system,
DAMON_LRU_SORT utilizes module parameters.  That is, you can put
``damon_lru_sort.<parameter>=<value>`` on the kernel boot command line or write
proper values to ``/sys/module/damon_lru_sort/parameters/<parameter>`` files.

Below are the description of each parameter.

enabled
-------

Enable or disable DAMON_LRU_SORT.

You can enable DAMON_LRU_SORT by setting the value of this parameter as ``Y``.
Setting it as ``N`` disables DAMON_LRU_SORT.  Note that DAMON_LRU_SORT could do
no real monitoring and LRU-lists sorting due to the watermarks-based activation
condition.  Refer to below descriptions for the watermarks parameter for this.

Annotation

Implementation Notes