[opensuse-support] swap starts being filled after upgrading to snapshot 20181116 of openSUSE Tumbleweed
Hello everyone, I have 24GB memory and 'vm.swappiness=1' enabled. But the swap space has been used, although only a little, lately after upgrading to snapshot 20181116 of openSUSE Tumbleweed. The swap was always empty before this. Does anyone know the reason? What should I do to avoid using swap unnecessarily? Here is the current memory usage, ``` cnzhx@ostp:~> free -m total used free shared buff/cache available Mem: 23986 8481 1662 4897 13841 10243 Swap: 2051 5 2046 ``` Best regards, ZHX -- To unsubscribe, e-mail: opensuse-support+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-support+owner@opensuse.org
On 18/11/2018 15.05, H Zeng wrote:
Hello everyone,
I have 24GB memory and 'vm.swappiness=1' enabled. But the swap space has been used, although only a little, lately after upgrading to snapshot 20181116 of openSUSE Tumbleweed. The swap was always empty before this. Does anyone know the reason? What should I do to avoid using swap unnecessarily?
Here is the current memory usage, ``` cnzhx@ostp:~> free -m total used free shared buff/cache available Mem: 23986 8481 1662 4897 13841 10243 Swap: 2051 5 2046 ```
Instead, you can use "top", then press 'f' to choose sorting by swap ('s' to fixate, 'q' to exit to display mode). That way you can find out if a process is using more swap than others. However, I read from the above that it is using only 5 MB of swap, out of a total of 2051 M. That's nothing! Mine is using 6 GB. -- Cheers / Saludos, Carlos E. R. (from 42.3 x86_64 "Malachite" at Telcontar)
On Monday, 19 November 2018 03:05:13 HKT Carlos E. R. wrote:
On 18/11/2018 15.05, H Zeng wrote:
Hello everyone,
I have 24GB memory and 'vm.swappiness=1' enabled. But the swap space has been used, although only a little, lately after upgrading to snapshot 20181116 of openSUSE Tumbleweed. The swap was always empty before this. Does anyone know the reason? What should I do to avoid using swap unnecessarily?
Here is the current memory usage, ``` cnzhx@ostp:~> free -m
total used free shared buff/cache
available Mem: 23986 8481 1662 4897 13841 10243 Swap: 2051 5 2046 ```
Instead, you can use "top", then press 'f' to choose sorting by swap ('s' to fixate, 'q' to exit to display mode).
That way you can find out if a process is using more swap than others. Hi, Carlos, thank you for this suggestion. I did not know that. Here is the current output,
Tasks: 254 total, 1 running, 253 sleeping, 0 stopped, 0 zombie
%Cpu(s): 6.8 us, 3.3 sy, 0.0 ni, 89.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0
st
MiB Mem : 23986.31+total, 7177.238 free, 5415.426 used, 11393.65+buff/cache
MiB Swap: 2051.996 total, 2051.793 free, 0.203 used. 16551.00+avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 20 0 189396 10452 7356 S 0.000 0.043 0:05.68 systemd
2 root 20 0 0 0 0 S 0.000 0.000 0:00.05 kthreadd
3 root 0 -20 0 0 0 I 0.000 0.000 0:00.00 rcu_gp
4 root 0 -20 0 0 0 I 0.000 0.000 0:00.00
rcu_par_gp
.........
Looks like it is systemd who used the most swap space.
However, I read from the above that it is using only 5 MB of swap, out of a total of 2051 M. That's nothing! Mine is using 6 GB.
Maybe I am too alert on the usage of swap. I do not have a good understanding on the usage of swap. I thought the OS should prefer RAM over swap in case that free RAM is available. But after reading [this post](http:// northernmost.org/blog/swap-usage-5-years-later/), I think you are right. -- Best regards, ZHX -- To unsubscribe, e-mail: opensuse-support+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-support+owner@opensuse.org
On 19/11/2018 01.21, H Zeng wrote:
On Monday, 19 November 2018 03:05:13 HKT Carlos E. R. wrote:
Instead, you can use "top", then press 'f' to choose sorting by swap ('s' to fixate, 'q' to exit to display mode).
That way you can find out if a process is using more swap than others. Hi, Carlos, thank you for this suggestion. I did not know that. Here is the current output,
Tasks: 254 total, 1 running, 253 sleeping, 0 stopped, 0 zombie %Cpu(s): 6.8 us, 3.3 sy, 0.0 ni, 89.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 23986.31+total, 7177.238 free, 5415.426 used, 11393.65+buff/cache MiB Swap: 2051.996 total, 2051.793 free, 0.203 used. 16551.00+avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1 root 20 0 189396 10452 7356 S 0.000 0.043 0:05.68 systemd 2 root 20 0 0 0 0 S 0.000 0.000 0:00.05 kthreadd 3 root 0 -20 0 0 0 I 0.000 0.000 0:00.00 rcu_gp 4 root 0 -20 0 0 0 I 0.000 0.000 0:00.00 rcu_par_gp .........
Looks like it is systemd who used the most swap space.
Oh, it seems I forgot another detail: to add ta swap column to the display. In the same "f" display, search for "swap" then activate it with "space". An asterisk will appear in front. Then move it to a suitable place for reading (the text says hoow). For instance, I have: Fields Management for window 1:Def, whose current sort field is %CPU Navigate with Up/Dn, Right selects for move then <Enter> or Left commits, 'd' or <Space> toggles display, 's' sets sort. Use 'q' or <Esc> to end! * PID = Process Id WCHAN = Sleeping in Function * USER = Effective User Name Flags = Task Flags <sched.h> * PR = Priority CGROUPS = Control Groups * NI = Nice Value SUPGIDS = Supp Groups IDs * VIRT = Virtual Image (KiB) SUPGRPS = Supp Groups Names * RES = Resident Size (KiB) TGID = Thread Group Id * SHR = Shared Memory (KiB) Adj = oom_adjustment (2^X) * SWAP = Swapped Size (KiB) Badness = oom_score (badness) * S = Process Status ENVIRON = Environment vars * %CPU = CPU Usage vMj = Major Faults delta * %MEM = Memory Usage (RES) vMn = Minor Faults delta * TIME+ = CPU Time, hundredths USED = Res+Swap Size (KiB) * COMMAND = Command Name/Line nsIPC = IPC namespace Inode PPID = Parent Process pid nsMNT = MNT namespace Inode ... Press "q" to display. If you like the result, "w" makes it permanent (I don't think you need to display swap permanently). Then change the sort order.
However, I read from the above that it is using only 5 MB of swap, out of a total of 2051 M. That's nothing! Mine is using 6 GB. Maybe I am too alert on the usage of swap. I do not have a good understanding on the usage of swap. I thought the OS should prefer RAM over swap in case that free RAM is available. But after reading [this post](http:// northernmost.org/blog/swap-usage-5-years-later/), I think you are right.
That the system uses some swap is not in itself bad, nor does it make the system slower per se. It is slower if it needs to actually use something that is in swap. If that thing is never needed again, why keep it in RAM, wasting space? Better swap out the chunks that are not needed, and get some free RAM instead. Do not look at how much swap is in use, but at how much is going and in and out per time unit. If you hibernate the machine, you will see on return that there is a fair number of MB in swap. Things get out of there if and when they are needed, not before. After some hours, you will see that some megabytes remains in swap - possibly the init section of all the programs, chunks that are not needed again during the use of the programs, so they remain there out of sight. The end result is that you have more free ram than before and the machine might run a bit faster, not slower. -- Cheers / Saludos, Carlos E. R. (from 42.3 x86_64 "Malachite" at Telcontar)
On Monday, 19 November 2018 09:16:30 HKT Carlos E.R. wrote:
On 19/11/2018 01.21, H Zeng wrote:
On Monday, 19 November 2018 03:05:13 HKT Carlos E. R. wrote:
Instead, you can use "top", then press 'f' to choose sorting by swap ('s' to fixate, 'q' to exit to display mode).
That way you can find out if a process is using more swap than others.
Hi, Carlos, thank you for this suggestion. I did not know that. Here is the current output, ``` Tasks: 254 total, 1 running, 253 sleeping, 0 stopped, 0 zombie %Cpu(s): 6.8 us, 3.3 sy, 0.0 ni, 89.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st MiB Mem : 23986.31+total, 7177.238 free, 5415.426 used, 11393.65+buff/cache MiB Swap: 2051.996 total, 2051.793 free, 0.203 used. 16551.00+avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 20 0 189396 10452 7356 S 0.000 0.043 0:05.68 systemd 2 root 20 0 0 0 0 S 0.000 0.000 0:00.05 kthreadd 3 root 0 -20 0 0 0 I 0.000 0.000 0:00.00 rcu_gp 4 root 0 -20 0 0 0 I 0.000 0.000 0:00.00
rcu_par_gp ......... ``` Looks like it is systemd who used the most swap space.
Oh, it seems I forgot another detail: to add ta swap column to the display. In the same "f" display, search for "swap" then activate it with "space". An asterisk will appear in front. Then move it to a suitable place for reading (the text says hoow). For instance, I have:
Fields Management for window 1:Def, whose current sort field is %CPU Navigate with Up/Dn, Right selects for move then <Enter> or Left commits, 'd' or <Space> toggles display, 's' sets sort. Use 'q' or <Esc> to end!
* PID = Process Id WCHAN = Sleeping in Function * USER = Effective User Name Flags = Task Flags <sched.h> * PR = Priority CGROUPS = Control Groups * NI = Nice Value SUPGIDS = Supp Groups IDs * VIRT = Virtual Image (KiB) SUPGRPS = Supp Groups Names * RES = Resident Size (KiB) TGID = Thread Group Id * SHR = Shared Memory (KiB) Adj = oom_adjustment (2^X) * SWAP = Swapped Size (KiB) Badness = oom_score (badness) * S = Process Status ENVIRON = Environment vars * %CPU = CPU Usage vMj = Major Faults delta * %MEM = Memory Usage (RES) vMn = Minor Faults delta * TIME+ = CPU Time, hundredths USED = Res+Swap Size (KiB) * COMMAND = Command Name/Line nsIPC = IPC namespace Inode PPID = Parent Process pid nsMNT = MNT namespace Inode ...
Press "q" to display. If you like the result, "w" makes it permanent (I don't think you need to display swap permanently). Then change the sort order. Thank you for the hint. Now I know how to operate top command.
However, I read from the above that it is using only 5 MB of swap, out of a total of 2051 M. That's nothing! Mine is using 6 GB.
Maybe I am too alert on the usage of swap. I do not have a good understanding on the usage of swap. I thought the OS should prefer RAM over swap in case that free RAM is available. But after reading [this post](http:// northernmost.org/blog/swap-usage-5-years-later/), I think you are right.
That the system uses some swap is not in itself bad, nor does it make the system slower per se. It is slower if it needs to actually use something that is in swap. If that thing is never needed again, why keep it in RAM, wasting space? Better swap out the chunks that are not needed, and get some free RAM instead.
Do not look at how much swap is in use, but at how much is going and in and out per time unit.
If you hibernate the machine, you will see on return that there is a fair number of MB in swap. Things get out of there if and when they are needed, not before. After some hours, you will see that some megabytes remains in swap - possibly the init section of all the programs, chunks that are not needed again during the use of the programs, so they remain there out of sight. The end result is that you have more free ram than before and the machine might run a bit faster, not slower. It is true that I have little swap data going in and out per time unit and I do not feel system going slower than usual. Thank you very much for the explanation.
Wish you a good day :) -- Best regards, ZHX -- To unsubscribe, e-mail: opensuse-support+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-support+owner@opensuse.org
participants (3)
-
Carlos E. R.
-
Carlos E.R.
-
H Zeng