Mailinglist Archive: opensuse-support (97 mails)

< Previous Next >
Re: [opensuse-support] swap starts being filled after upgrading to snapshot 20181116 of openSUSE Tumbleweed
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
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

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

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://, 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)

< Previous Next >
Follow Ups