如何更改Linux内核交换守护程序(kswapd)超时? [英] How to change the Linux kernel swap daemon (kswapd) timeout?

查看:103
本文介绍了如何更改Linux内核交换守护程序(kswapd)超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过使用快速设备(如Flash,SSD)作为交换设备来减少kswapd超时以提高性能.

I want to reduce the kswapd timeout to increase the performance by use of fast devices like Flash, SSD as swapping devices.

推荐答案

您可以通过两种方式更改kswapd的行为

You can change the behavior of kswapd through 2 ways

来自 IBM Developerworks

/proc/sys/vm/kswapd

  1. 内核一次尝试释放的最大页面数.如果要增加到/从交换的带宽,则需要增加 这个号码.

  1. Maximum number of pages the kernel tries to free at one time. If you want to increase bandwidth to/from swap, you will need to increase this number.

内核在每次交换中尝试释放页面的最小次数.

Minimum number of times the kernel tries to free a page on each swap.

内核一次交换可写入的页面数.这对系统性能有最大的影响.值越大,越多 可以交换数据,减少花费在磁盘搜索上的时间.然而, 太大的值会对系统性能产生不利影响 泛滥请求队列

The number of pages the kernel can write in one swap. This has the greatest impact on system performance. The larger the value, the more data can be swapped and the less time is spent disk seeking. However, a value that is too large will adversely affect system performance by flooding the request queue

通过内核代码

kswapd(void * p)调用 kswapd_try_to_sleep(). 这是kswapd守护程序试图休眠的地方.像这样-

Through Kernel Code

kswapd( void *p ) calls kswapd_try_to_sleep(). Here is where the kswapd daemon tries to sleep. Like this-

schedule_timeout(HZ/10) /* You need to modify here to change the timeout value */

实际上,这是一个很短的睡眠时间.经过短暂的睡眠后,它会检查是否为早睡.如果没有,它将完全进入睡眠状态(此处没有超时),直到被明确唤醒.

Actually this is a very short time period for which it sleeps. After this short sleep, it checks if it was a premature sleep. If not, it goes fully to sleep ( no timeout here ) until explicitly woken up.

调整内核代码,构建和测试它并非易事.因此,我建议您采用/proc文件系统方式!

Tweaking the kernel code, building and testing it is no easy task. So I suggest you go the /proc filesystem way!

这篇关于如何更改Linux内核交换守护程序(kswapd)超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆