Date
1 - 4 of 4
Swap management: vm.swappiness best values?
Mauro Ziliani
Hi all. I'm working with Krogoth on a imx6dl board with 1GB of RAM. I don't setup the swap space, but sometimes I see that kswap0 task starts, and the board slow down. I'd like to change the value of vm.swappiness to avoid swap requests The default value of vm.swappiness is 60. There is a minimum value for vm.swappiness? Best regards, MZ |
|
Laurent Gauthier
Ciao Mauro, Sounds more like a pure Linux/UNIX question than a yocto one :-) As you most likely know on an embedded system which uses permanent storage (NAND flash or eMMC) that is subject to wear it is important to completely turn off swap. At runtime if the system is up and running then you should issue the "swapoff -a" command. But the proper fix is to remove any entry from your /etc/fstab designating a swap partition. However I would be surprised if you had a swap partition configured in your system as most embedded systems don't have one. Instead what I am thinking is that you are likely seeing a system slow-down due to your system's memory usage coming close to 100% of the available RAM, which in turn causes all calls to memory allocation functions to slow down (algorithms have to look harder to find available memory). I would suggest that when the issue occurs that you first check the current system memory usage and have a look at which application is using the most memory and figure out if there is a way to optimize it and reduce the memory usage. Kind regards, Laurent. On Tue, Mar 9, 2021 at 10:03 AM Mauro Ziliani <mauro@...> wrote:
|
|
Mauro Ziliani
Thank you for the answer. May be I explain my problem not so well :-( I don't have enabled swap partition in fstab and if I run swapon nothing is shown. The swap partition is not defined anywhere in the system. Only the manager is available in the kernel. I made an analisys of memory usage before posting this, and I see that when the free ram drop under 600MB the kernel thread mmcq/2 and kswap0 starts to work. I see the this 600MB is 60% of 1GB, and vm.swapping=60. So I ask here if someone has some experience. with vm.swappiness value on embedded. You have centered perfecly the matter about the slow-down: when memory drop to low, the system is tired to work. I cannot explain why even if no swap spaces are defined, kswap0 works Now I try to put vm.swappiness=6 and it seems to work well MZ On mar 9 2021, at 12:17 pm, Laurent Gauthier <laurent.gauthier@...> wrote:
|
|
Laurent Gauthier
Hi again, kswapd is triggered (even when there is no swap space) to reclaim some space when the memory runs low. There is no way to turn it completely off, with the swappiness parameter you can control how pro-active it will be. One of the ways it manages to "reclaim" memory (even if there is no swap storage defined) is that it can trigger a compaction of memory zones, therefore reducing memory fragmentation by removing "holes". This defragmentation will help with the allocation of larger memory blocks. If you reduce the swappiness setting to zero it will still trigger at some point, but just much later. Kind regards, Laurent. On Tue, Mar 9, 2021 at 5:21 PM Mauro Ziliani <mauro@...> wrote:
|
|