Documentation/translations/zh_TW/admin-guide/mm/damon/reclaim.rst
Source file repositories/reference/linux-study-clean/Documentation/translations/zh_TW/admin-guide/mm/damon/reclaim.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/translations/zh_TW/admin-guide/mm/damon/reclaim.rst- Extension
.rst- Size
- 8016 bytes
- Lines
- 230
- 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.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
.. SPDX-License-Identifier: GPL-2.0
.. include:: ../../../disclaimer-zh_TW.rst
:Original: Documentation/admin-guide/mm/damon/reclaim.rst
:翻譯:
司延騰 Yanteng Si <siyanteng@loongson.cn>
:校譯:
===============
基於DAMON的回收
===============
基於DAMON的回收(DAMON_RECLAIM)是一個靜態的內核模塊,旨在用於輕度內存壓力下的主動和輕
量級的回收。它的目的不是取代基於LRU列表的頁面回收,而是有選擇地用於不同程度的內存壓力和要
求。
哪些地方需要主動回收?
======================
在一般的內存超量使用(over-committed systems,虛擬化相關術語)的系統上,主動回收冷頁
有助於節省內存和減少延遲高峯,這些延遲是由直接回收進程或kswapd的CPU消耗引起的,同時只產
生最小的性能下降 [1]_ [2]_ 。
基於空閒頁報告 [3]_ 的內存過度承諾的虛擬化系統就是很好的例子。在這樣的系統中,客戶機
向主機報告他們的空閒內存,而主機則將報告的內存重新分配給其他客戶。因此,系統的內存得到了充
分的利用。然而,客戶可能不那麼節省內存,主要是因爲一些內核子系統和用戶空間應用程序被設計爲
使用盡可能多的內存。然後,客戶機可能只向主機報告少量的內存是空閒的,導致系統的內存利用率下降。
在客戶中運行主動回收可以緩解這個問題。
它是如何工作的?
================
DAMON_RECLAIM找到在特定時間內沒有被訪問的內存區域並分頁。爲了避免它在分頁操作中消耗過多
的CPU,可以配置一個速度限制。在這個速度限制下,它首先分頁出那些沒有被訪問過的內存區域。系
統管理員還可以配置在什麼情況下這個方案應該自動激活和停用三個內存壓力水位。
接口: 模塊參數
==============
要使用這個功能,你首先要確保你的系統運行在一個以 ``CONFIG_DAMON_RECLAIM=y`` 構建的內
核上。
爲了讓系統管理員啓用或禁用它,併爲給定的系統進行調整,DAMON_RECLAIM利用了模塊參數。也就
是說,你可以把 ``damon_reclaim.<parameter>=<value>`` 放在內核啓動命令行上,或者把
適當的值寫入 ``/sys/module/damon_reclaim/parameters/<parameter>`` 文件。
下面是每個參數的描述。
enabled
-------
啓用或禁用DAMON_RECLAIM。
你可以通過把這個參數的值設置爲 ``Y`` 來啓用DAMON_RCLAIM,把它設置爲 ``N`` 可以禁用
DAMON_RECLAIM。注意,由於基於水位的激活條件,DAMON_RECLAIM不能進行真正的監測和回收。
這一點請參考下面關於水位參數的描述。
min_age
-------
識別冷內存區域的時間閾值,單位是微秒。
如果一個內存區域在這個時間或更長的時間內沒有被訪問,DAMON_RECLAIM會將該區域識別爲冷的,
並回收它。
默認爲120秒。
Annotation
- Atlas domain: Support Tooling And Documentation / Documentation.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.