How to change Linux kernel swap timeout (kswapd)?

I want to decrease kswapd timeout to increase performance by using fast devices like Flash, SSD as swap.


source to share

1 answer

You can change the behavior kswapd

in 2 ways

Through the Proc file system

From IBM Developerworks ,

/ Proc / SYS / VM / kswapd

  • The maximum number of pages that the kernel tries to free at one time. If you want to increase the throughput to / from swap, you will need to increase this number.

  • The minimum number of times the kernel tries to free the page on every swap.

  • The number of pages that the kernel can write in one exchange. This has the greatest impact on system performance. The higher the value, the more data can be swapped and the less time is spent searching for a disk. However, too high a value will negatively affect system performance by flooding the request queue.

Through kernel code

kswapd (void * p) calls kswapd_try_to_sleep () . This is where the demon kswapd

tries to sleep. Like this -

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


This is actually a very short period of time for which he sleeps. After this short nap, he checks to see if it was a premature dream. If not, it goes to sleep completely (no timeout here) until it explicitly wakes up.

Setting up kernel code, building, and testing is not an easy task. So I suggest you go to the filesystem /proc




All Articles