linux kernel swap daemon

Posted 良红

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux kernel swap daemon相关的知识,希望对你有一定的参考价值。

  The name swap daemon is a bit of a misnomer as the daemon does more than just swap modified pages out to the swap file. Its task is to keep the memory management system operating efficiently. The Kernel swap daemon (kswapd kernel init process at startup time and sits waiting for the kernel swap timer to periodically expire. ) is started by the Every time the timer expires, the swap daemon looks to see if the number of free pages in the system is getting too low. 

  Linux does not want too many pages being written to the swap file at the same time so it uses nr_async_pages to keep count of the number of pages currently being written to the swap file. free_pages_low and free_pages_high are set at system startup time and are related to the number of physical pages in the system. If there are enough free pages, the swap daemon sleeps until its timer expires again, otherwise the swap daemon tries three ways to reduce the number of physical pages being used by the system:

Reducing the size of the buffer and page caches,
Swapping out shared pages,
Swapping out or discarding pages.

 

By default, the swap daemon tries to free up 4 pages each time it runs. The above methods are each tried in turn until enough pages have been freed. The swap daemon then sleeps again until its timer expires.

以上是关于linux kernel swap daemon的主要内容,如果未能解决你的问题,请参考以下文章

Linus发出警告:请勿使用Linux Kernel 5.12-rc1

02Linux系统安装,组成及开关机

开源技术分享:Linux 内核参数 swappiness细解

Linux--CentOS下载和安装

linux设置开启swap交换分区基本命令(虚拟内存)

如何减小现有的linux swap分区~