How to change the Linux kernel swap daemon (kswapd) timeout?

会有一股神秘感。 提交于 2019-12-12 14:34:21

问题


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


回答1:


You can change the behavior of kswapd through 2 ways

Through Proc File System

From IBM Developerworks,

/proc/sys/vm/kswapd

  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.

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

  3. 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

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.

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



来源:https://stackoverflow.com/questions/9817737/how-to-change-the-linux-kernel-swap-daemon-kswapd-timeout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!