Leap 15.1 slows down due to swapping

I have a new HP Laptop since September 2019 and installed Leap 15.1, which has been giving me problems. It slows down after a few weeks. When starting any new program or most actions take 10 to 15 seconds to react. Using Xosview I find all of 3.8 GB main memory is used as well as 2 Gb of swap memory and the system is busy page swapping. The only way to work around this is to reboot. This never happened with Leap 42.3 on my older Compaq laptop and other SuSE distributions in the past, which normally ran for months without having to reboot.

Hardware:

HP Laptop 15-da0039TU
4 x Intel Core i3-8130U CPU @ 2.2GHz
3.8 GiB of RAM
1 TB Hard Drive + 16 GB Intel Optane (Cache)

Software:

Dual boot with Windows 10 using ~500 GB and Linux Leap 15.1 ~500 GB
KDE Plasma Version: 5.12.8
corrimal:~# free
              total        used        free      shared  buff/cache   available
Mem:        3946176     1951176      131480      478616     1863520     1280888
Swap:       2097148      217568     1879580
corrimal:~ # cat /proc/swaps
Filename                                Type            Size    Used    Priority
/dev/sda7                               partition       2097148 217568  -1

I mostly run command line software editing with vi and compiling with gcc in 6 Konsole windows with about 4 Tabs each. I do leave Thunderbird running and Firefox with about 8 Tabs as a rule, as well as one Dolphin file explorer window starting Libre Office Word occasionally.

When I first reboot all those programs take up about 2.5 GB of memory and no swapping. After a few days, without much change in my work environment I see a very small amount of swap (50 MB). That increases steadily day by day until after about 4 weeks half the swap (1 GB) is used up. At that point everything becomes noticeably slower - 5 seconds to start a new program. After that within a few days all the swap space (2 GB) is used and page swapping sets in (as seen on Xosview). At that points starting a new program may take 20 - 40 seconds. Soon things start to freeze and the only option is to reboot.

The interesting part is, that although I close most Firefox Tabs after I have finished viewing a web page and all command line stuff anyway, the Swap space once used never seems to get less. I do leave Thunderbird running with 3 gmail accounts using imap. I have worked this way for years with many different versions of SuSE Linux (my first contact with SuSE Linux was in 1994) My previous Laptop, which is still running Leap 4.3 has been running for over a year and never slows down as have all previous openSUSE and SuSE Linuxes.

The only unusual hardware feature of this HP Laptop is the 16 GB Intel Optane (SSD Cache) associated with the conventional 1 TB hard drive, which should not need any software driver support - or does it ?? PLS investigate.

What is happening here? Can I fix it?

I am posting now to make sure this is looked at before the release of Leap 15.2.

PS: I very rarely boot Windows 10 - gives trouble anyway. After a few months the updates are so numerous the system gets confused !!

In order to debug the issue, we’d have to see the output of something like ps aux when the memory usage is hitting all time high - most likely something is leaking memory left and right.

+1
I would bet on Thunderbird as the culprit, since it has a history of memory leaks. Maybe closing and restarting Thunderbird from time to time might avoid the need to reboot.
Anyway the last few lines of

ps aux k %mem

should show what is eating up your memory. Some usage of swap space is not a problem per se, unless you tweaked system settings in a wrong way, but steadily increasing memory usage points to a memory leak somewhere and one process should stand out as soon as your system starts to increase memory usage with no apparent reason.

As suggested, here is the output of the last lines of ps aux k %mem

corrimal:~ # ps aux k %mem
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
jw        2539  0.0  0.1 196844  3948 ?        Sl   Jun06   0:14 /usr/lib64/ibus/ibus-engine-simple
jw        2568  0.0  0.1  19308  4040 pts/6    Ss+  Jun06   0:00 /bin/bash
root      2525  0.0  0.1 117396  4048 pts/14   Ss   Jun06   0:00 /usr/bin/su -
jw        2611  0.0  0.1  19308  4056 pts/9    Ss+  Jun06   0:00 /bin/bash
jw        2427  0.0  0.1 272700  4092 ?        Sl   Jun06   0:00 /usr/lib64/ibus/ibus-dconf
root      2578  0.0  0.1 117396  4092 pts/4    Ss   Jun06   0:00 /usr/bin/su -
jw        2630  0.0  0.1  19308  4108 pts/12   Ss+  Jun06   0:00 /bin/bash
jw        2241  0.0  0.1 187692  4112 ?        Sl   Jun06   0:00 /usr/lib/dconf-service
jw        2685  0.0  0.1 421848  4144 ?        Ssl  Jun06   0:00 /usr/lib/xdg-document-portal
root      2639  0.0  0.1 117396  4164 pts/13   Ss   Jun06   0:00 /usr/bin/su -
jw        2459  0.0  0.1  19308  4176 pts/0    Ss+  Jun06   0:00 /bin/bash
jw        2593  0.0  0.1  19308  4192 pts/7    Ss+  Jun06   0:00 /bin/bash
jw        2383  0.0  0.1  65656  4208 ?        S    Jun06   0:00 /usr/lib/GConf/2/gconfd-2
jw        2456  1.1  0.1  32244  4220 ?        S    Jun06  49:50 /usr/bin/xosview +net +bat
root      2621  0.0  0.1 117396  4228 pts/10   Ss   Jun06   0:00 /usr/bin/su -
jw        2477  0.0  0.1  19308  4232 pts/2    Ss+  Jun06   0:00 /bin/bash
jw        2557  0.0  0.1  19308  4260 pts/15   Ss+  Jun06   0:00 /bin/bash
jw        2941  0.0  0.1 427064  4304 ?        SLl  Jun06   0:00 /usr/bin/gnome-keyring-daemon --start --foreground 
postfix   1570  0.0  0.1  60296  4364 ?        S    Jun06   0:00 qmgr -l -t fifo -u
jw        2446  0.0  0.1 270648  4460 ?        Sl   Jun06   0:00 /usr/lib64/ibus/ibus-portal
root      1206  0.0  0.1  92472  4560 ?        Ss   Jun06   0:00 /usr/sbin/cupsd -l
jw        2378  0.0  0.1  85556  4712 ?        S    Jun06   0:00 /usr/lib/pulse/gconf-helper
jw        2415  0.0  0.1 283048  4904 ?        Ssl  Jun06   0:00 /usr/lib/gvfs/gvfsd
jw        2010  0.0  0.1  40680  4912 ?        Ss   Jun06   0:00 /usr/bin/dbus-daemon --session --address=systemd: -
jw        2259  0.0  0.1  91308  5020 ?        S    Jun06   0:00 kwrapper5 /usr/bin/ksmserver
jw        2448  0.0  0.1  60892  5156 ?        S    Jun06   0:00 /usr/lib/bluetooth/obexd
root      1208  0.0  0.1 430100  5304 ?        Ssl  Jun06   0:00 /usr/sbin/ModemManager
root      2257  0.0  0.1 296416  5408 ?        Ssl  Jun06   0:12 /usr/lib/upower/upowerd
jw        1992  0.0  0.1  72336  5456 ?        Ss   Jun06   0:00 /usr/lib/systemd/systemd --user
jw        2535  0.0  0.1 218772  5584 ?        Sl   Jun06   0:04 /usr/lib/at-spi2/at-spi2-registryd --use-gnome-sess
root      1883  0.0  0.1 1090556 6368 ?        Sl   Jun06   4:06 /opt/teamviewer/tv_bin/teamviewerd -d
postfix  32458  0.0  0.1  60048  6384 ?        S    11:03   0:00 pickup -l -t fifo -u
jw        2411  0.0  0.1 346280  6412 ?        Ssl  Jun06   0:55 ibus-daemon --xim -d
jw        2524  0.0  0.1 344856  6444 ?        Ssl  Jun06   0:00 /usr/lib/at-spi2/at-spi-bus-launcher
jw        2424  0.0  0.1 637656  6468 ?        Sl   Jun06   0:13 /usr/lib/gvfs/gvfsd-fuse /run/user/1000/gvfs -f -o 
root         1  0.0  0.1 220868  6900 ?        Ss   Jun06   0:13 /usr/lib/systemd/systemd --switched-root --system -
root      3169  0.0  0.1  19240  7180 pts/13   S    Jun06   0:00 -bash
root      1972  0.0  0.1 194116  7220 ?        Sl   Jun06   0:00 /usr/bin/sddm
jw        2605  0.0  0.1 640436  7296 ?        Ssl  Jun06   0:00 /usr/lib/xdg-desktop-portal
root      1989  0.0  0.2 187140  8244 ?        S    Jun06   0:00 /usr/lib/sddm/sddm-helper --socket /tmp/sddm-auth54
jw       14681  0.0  0.2 267388  8284 ?        S    Jun07   0:04 file.so [kdeinit5] file local:/run/user/1000/klaunc
jw        2757  0.0  0.2  87612  9172 ?        S    Jun06   0:45 /usr/bin/perl /usr/local/bin/iCman -geometry 85x28+
root      1286  0.0  0.2 593476  9268 ?        Ssl  Jun06   2:54 /usr/sbin/NetworkManager --no-daemon
root      2251  0.0  0.2 440156  9540 ?        Ssl  Jun06   0:23 /usr/lib/udisks2/udisksd
jw        2217  0.0  0.2 265044  9788 ?        Ss   Jun06   0:00 kdeinit5: Running...
jw        2287  0.0  0.2 354296 10300 ?        Sl   Jun06   0:02 /usr/lib64/libexec/kf5/kscreen_backend_launcher
jw        2355  0.0  0.2 2215572 11052 ?       S<l  Jun06   0:15 /usr/bin/pulseaudio --start --log-target=syslog
root      1202  0.0  0.2 233312 11496 ?        Ssl  Jun06   0:01 /usr/bin/python3 -Es /usr/sbin/firewalld --nofork -
message+  1187  0.0  0.2  48088 11640 ?        Ss   Jun06   2:04 /usr/bin/dbus-daemon --system --address=systemd: --
jw        2303  0.0  0.2 369152 11792 ?        Sl   Jun06   0:02 /usr/bin/xembedsniproxy
jw        2789  0.0  0.3 518756 12856 ?        Sl   Jun06   0:02 /usr/lib64/libexec/xdg-desktop-portal-kde
jw        2925  0.0  0.3 522712 13004 ?        Sl   Jun06   0:03 /usr/bin/kuiserver5
jw        2321  0.0  0.3 796408 14392 ?        Sl   Jun06   0:12 /usr/bin/kactivitymanagerd start-daemon
jw        2229  0.0  0.3 521092 15428 ?        Sl   Jun06   0:02 /usr/bin/kglobalaccel5
jw        2443  0.0  0.3 468668 15540 ?        Sl   Jun06   0:01 /usr/lib64/ibus/ibus-x11 --kill-daemon
jw        2218  0.0  0.3 520604 15576 ?        Sl   Jun06   0:03 /usr/lib64/libexec/kf5/klauncher --fd=9
jw        2323  0.0  0.4 636224 15796 ?        Sl   Jun06   0:21 /usr/lib64/libexec/kdeconnectd
jw        2230  0.0  0.4 544104 16264 ?        Sl   Jun06   0:04 /usr/bin/kaccess
jw        2339  0.0  0.4 665748 17308 ?        Sl   Jun06   0:07 /usr/lib64/libexec/org_kde_powerdevil -session 1011
jw        2300  0.0  0.4 692372 17628 ?        Sl   Jun06   0:02 /usr/lib64/libexec/polkit-kde-authentication-agent-
jw        2437  0.0  0.4 547332 17816 ?        Sl   Jun06   0:08 /usr/lib64/ibus/ibus-extension-gtk3
jw        2428  0.0  0.4 625128 17892 ?        Sl   Jun06   0:09 /usr/lib64/ibus/ibus-ui-gtk3
jw        2261  0.0  0.4 640688 19456 ?        Sl   Jun06   0:05 /usr/bin/ksmserver
polkitd   1260  0.0  0.5 2045384 22656 ?       Ssl  Jun06   0:01 /usr/lib/polkit-1/polkitd --no-debug
jw        2921  0.0  0.6 718176 26156 ?        Sl   Jun06   0:07 /usr/lib/mozilla/kmozillahelper
jw        6522  0.0  0.6 720856 27368 ?        Sl   Jun06   0:07 /usr/lib/mozilla/kmozillahelper
jw        2369  0.0  0.7 887952 30808 ?        Sl   Jun06   1:20 /usr/bin/ktorrent -session 10ccdcd3de00015716166460
jw        2296  0.0  0.8 875440 33996 ?        Sl   Jun06   0:06 /usr/bin/krunner
jw        2221  0.0  0.9 1273688 38912 ?       Sl   Jun06   0:39 kded5 [kdeinit5]
jw        2375  0.0  1.0 895556 39880 ?        Sl   Jun06   1:00 /usr/bin/dolphin -session 10ccdcd3de000157554809000
jw        2291  0.0  1.0 3006244 42160 ?       Sl   Jun06   2:50 kwin_x11 -session 10ccdcd3de00015763687790000001772
root       419  0.0  1.2 139212 49704 ?        Ss   Jun06   0:22 /usr/lib/systemd/systemd-journald
jw        2343  0.1  1.6 788508 66980 ?        Sl   Jun06   6:04 /usr/bin/konsole -session 10ccdcd3de000157275113000
jw        2293  0.0  1.7 268775200 67340 ?     SNl  Jun06   0:08 /usr/bin/baloo_file
jw        6511  0.0  1.7 2614180 69732 ?       Sl   Jun06   1:07 /usr/lib64/firefox/firefox -contentproc -childID 4 
jw        7472  0.0  2.0 2625872 79676 ?       Sl   Jun06   0:28 /usr/lib64/firefox/firefox -contentproc -childID 13
jw        7435  0.0  2.0 2689920 81080 ?       Sl   Jun06   0:44 /usr/lib64/firefox/firefox -contentproc -childID 12
jw       23121  0.0  2.4 2670912 95904 ?       Sl   Jun08   0:23 /usr/lib64/firefox/firefox -contentproc -childID 20
jw       13858  0.1  3.3 2745676 133448 ?      Sl   Jun07   5:39 /usr/lib64/firefox/firefox -contentproc -childID 17
jw        7676  0.2  3.4 2787424 135572 ?      Sl   Jun06  11:08 /usr/lib64/firefox/firefox -contentproc -childID 14
jw       23145  0.1  3.5 2685640 141012 ?      Sl   Jun08   2:08 /usr/lib64/firefox/firefox -contentproc -childID 21
jw        6657  0.3  3.6 2818424 144472 ?      Sl   Jun06  16:23 /usr/lib64/firefox/firefox -contentproc -childID 6 
jw        2298  0.1  3.6 4279684 145080 ?      Sl   Jun06   8:13 /usr/bin/plasmashell
jw        6576  0.1  4.6 2847980 183876 ?      Sl   Jun06   6:42 /usr/lib64/firefox/firefox -contentproc -childID 5 
root      1976  0.5  5.8 702764 229924 tty7    Ssl+ Jun06  23:11 /usr/bin/X -nolisten tcp -auth /run/sddm/{0101477b-
jw        2386  0.1  8.1 3582432 321908 ?      Sl   Jun06   6:24 /usr/lib64/thunderbird/thunderbird-bin --sm-client-
jw        6346  0.7  9.2 4094840 365296 ?      Sl   Jun06  30:51 /usr/lib64/firefox/firefox

Firefox seems to use most memory - then thunderbird.
Versions are:

corrimal:~ # firefox --version
Mozilla Firefox 68.8.0esr
corrimal:~ # thunderbird --version
 Thunderbird 68.8.0

The system was rebooted on June 06. Today June 09 swap usage is 337120, up from 217568 yesterday (see above)

corrimal:~ # free
              total        used        free      shared  buff/cache   available
Mem:        3946176     1818792      265292      322724     1862092     1558052
Swap:       2097148      337120     1760028

Already executing an action like stopping a program which has not been used for a while (Skype in this case) takes 5 seconds before the Skype icon disappears from the task bar !! This slowness is my main complaint.
I will continue to watch this.

Adding more memory is a quick fix to your problem. My i3-4130 has 16 GB. For most users 8 GB will be fine. Replacing the hybrid drive by a SSD will help too.

Harsh reality is that Firefox, alone, is using 50% of your system memory and 4GiB today isn’t that much due to process isolation in browsers and constantly ballooning software memory use. Combine those things with a non-SSD system and unfortunately you’re pretty much boned.

You could try slimming down KDE, disabling Baloo (search indexer), setting vm.swappiness to 1 and other tuning but at the end of the day the only real fix would be to get 4-8 more memory if the system has multiple memory slots. 4GB is around 20€ and 8GB is around 40€ at least over here.

I had a feeling my 4 GB memory may be a little slim for modern systems, but I was hoping that Linux would not be as memory hungry as WinDOOF has been getting for some time.

I would gladly spend 40€, but I did buy a cheap laptop last year which as far as I can make out does not even have a replaceable battery or access to the hard disk or memory. I will investigate.

As far as the hybrid 1TB disk with 16GB SSD cache I am also very suspicious. Every action which involves access to the hard disc, like starting a new program literally takes at least 5 seconds, often more. Even if swapping was involved that looks to me like a long time. The SSD cache does not seem to be working and I suspect the way the disc drivers are written, causes conflicts which slows things down. Unfortunately I cannot even get at that disc to replace it.

My previous Compaq Laptop also has

3.7 GB of RAM
2 x Intel Pentium CPU B940 @ 2 GHz 
500 GB SSD
It runs Leap 42.3, KDE 5.8.7

That system runs like a charm and has never slowed down and I have never seen swapping, despite the fact that my work style has not changed. (The reason I replaced the 8 year old Compaq was that its keyboard was failing)

Thanks for all the help so far.

Unfortunately it’s not so much a “Linux problem” as it is a “Firefox problem” (or any other browser)

Modern browsers have gotten extremely fat when it comes to features and bloat, since each process is now its own isolated sandbox literally every single page takes 100M+ memory + possible extensions you may have even if it literally prints out hello world. It’s gotten completely absurd.

What about your system:

erlangen:~ # inxi -zSMmD
System:    Kernel: 5.6.14-1-default x86_64 bits: 64 Console: tty 3 Distro: openSUSE Tumbleweed 20200604 
Machine:   Type: Desktop Mobo: ASRock model: Z170 Pro4S serial: <filter> UEFI: American Megatrends v: P3.50 date: 06/23/2016 
Memory:    RAM: total: 31.05 GiB used: 2.79 GiB (9.0%) 
           Array-1: capacity: 64 GiB slots: 4 EC: None 
           Device-1: ChannelA-DIMM0 size: No Module Installed 
           Device-2: ChannelA-DIMM1 size: 16 GiB speed: 2133 MT/s 
           Device-3: ChannelB-DIMM0 size: No Module Installed 
           Device-4: ChannelB-DIMM1 size: 16 GiB speed: 2133 MT/s 
Drives:    Local Storage: total: 6.38 TiB used: 1.46 TiB (22.9%) 
           ID-1: /dev/nvme0n1 vendor: Samsung model: SSD 950 PRO 512GB size: 476.94 GiB 
           ID-2: /dev/sda vendor: Western Digital model: WD40EZRX-22SPEB0 size: 3.64 TiB 
           ID-3: /dev/sdb vendor: Samsung model: SSD 850 EVO 500GB size: 465.76 GiB 
           ID-4: /dev/sdc vendor: Crucial model: CT2000BX500SSD1 size: 1.82 TiB 
erlangen:~ # 

Just checked here, Firefox 68.8.0esr is using some 3.7GB with 20 tabs open but I didn’t care so far since there are 16 GB of RAM on this system.
I fired up a VM with 4GB and no swap, just opening 5 casual tabs on Firefox 69.0.3 eats up 40% of RAM.
Checked with an old test box, 2 GB RAM + 2 GB swap on rotating rust, as soon as I open 5 tabs on Firefox I see some swapping, 70% of RAM used by Firefox and starting a new terminal or calculator may take 5 seconds or so.
I remember using the latter up to Leap 42.3 (but with an SSD at the time) and that system was quite usable, so in a way I can confirm the feeling of the OP.
Likely I upgraded my HW before Firefox started being so hungry for RAM, but apparently opening more than a few tabs in current Firefox with 4GB of RAM is not a good idea.

Hi
Some laptops I’ve opened up only have one slot with the other having no RAM carrier… some even just have it onboard and not upgradeable…

@OP, find the service manual for your system, using your part number I get here: http://h10032.www1.hp.com/ctg/Manual/c06510442 but this is an AMD model, but peruse as like one of mine, the rubber strips hide the screws to disassemble… Also check perhaps with where you purchased to see if RAM can be upgraded…

When considering to buy always consult “Product Specifications” e.g.: HP Pavilion 15 Review: An affordable but unremarkable lifestyle laptop and the “Maintenance and Service Guide”, e.g. http://h10032.www1.hp.com/ctg/Manual/c04763947

Here is my “inxi -zSMmD” output. It shows that there is a free slot for more memory. I will follow that up today.

corrimal:~ # inxi -zSMmD
System:    Kernel: 4.12.14-lp151.28.48-default x86_64 bits: 64 Console: tty 13 Distro: openSUSE Leap 15.1 
Machine:   Type: Laptop System: HP product: HP Laptop 15-da0xxx v: Type1ProductConfigId serial: <filter> 
           Mobo: HP model: 84A6 v: 80.28 serial: <filter> UEFI: Insyde v: F.04 date: 08/02/2018 
Memory:    RAM: total: 3.76 GiB used: 2.53 GiB (67.3%) 
           Array-1: capacity: 32 GiB slots: 2 EC: None 
           Device-1: Bottom-slot 1(left) size: 4 GiB speed: 2400 MT/s 
           Device-2: Bottom-slot 2(right) size: No Module Installed 
Drives:    Local Storage: total: 931.51 GiB used: 188.05 GiB (20.2%) 
           ID-1: /dev/sda vendor: Toshiba model: MQ04ABF100 size: 931.51 GiB 

Try to lower your swappiness. The default I think is 60, wich mean that swap will be used if you use more than 40% of total memory. That’s too low for a desktop.

to see the actual parameter, as root : sysctl vm.swappiness

I fixed mine at 15 so my laptop can use 85% of the memory before swapping. I have 6GB memory and Tumbleweed with KDE is very fast and responsive.
But I’m limited with KVM to one virtual machine with about half the resources if I want to keep the laptop responsive.

to change it for a test : # sysctl vm.swappiness=15

You can make it permanent bye adding the following text file in /etc/sysctl.d directory :

inux-0rk5:/etc/sysctl.d # cat 001-swappiness.conf
vm.swappiness = 15

Give it a try, it costs nothing. :wink:

Do not spread wrong information. swappiness parameter has absolutely nothing to do with amount of free memory. It defines whether kernel prefers to reclaim file-mapped or anonymous pages.

Looking for a service manual with your laptop code I land here
According to the “Memory module” paragraph there are 2 available slots compatible with modules up to 8 GB each, so your system should be upgradeable to 8 or 16 GB.
Since the i3-8130U processor uses dual-channel memory, there is an advantage in using both slots, i.e. it is better to add a second 4GB module rather than swapping the existing 4GB for a single 8GB module; please also note that it is not a good idea to mix modules of different sizes, speeds etc…
I would definitely go for an additional 4GB of the same type of the standard one (but, of course, it’s your system and your choice).
BTW, if you are short on physical memory there is very little you can do by tweaking swap parameters and I would not touch that unless you know very well what you are doing.
WRT the 16 GB “Optane” memory in your laptop, that is not used as a disk cache on Linux AFAIK, but you should be able to use it as an additional 16 GB SSD unit and you can consider installing the operating system there; please open a separate thread with a clear title if you need help on that.

Just want to add: Always make one step at a time. Add the SODIMM and watch for changes. Only then change disk drive an enjoy the performance of a SSD.

Hi
Like I said before, check the hardware first to ensure there is a second RAM carrier present before going and purchasing RAM :wink: Likewise I would go for two modules if possible.

Swapping drives is easy: https://www.youtube.com/watch?v=VdtvQrmL5T8