You are not logged in.

#1 2021-02-09 04:11:04

BenniTec
Member
Registered: 2020-09-11
Posts: 24

Unusually high memory usage

With only 4 Tasks (init, login, bash, htop) the system consumes about 450MiB of RAM.
This was measured after

echo 1 | doas tee /proc/sys/vm/drop_caches

Normally I have less than 100MiB used while without desktop running.
I even rmmod a few modules (like nvidia) and still about 450MiB.
A few days ago I was experimenting with Hugepages for Monero Mining.
But then I disabled it in sysctl.conf:

vm.nr_hugepages=0

Currently, running Cinnamon and Chromium, I have about 2GiB used (about 2x of normal).
I tried running linux-lts but still no change.

Offline

#2 2021-02-09 12:40:42

mpan
Member
Registered: 2012-08-01
Posts: 1,585
Website

Re: Unusually high memory usage

Please provide the output of:

free -h

Paperclips in avatars? | Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#3 2021-02-09 13:37:56

BenniTec
Member
Registered: 2020-09-11
Posts: 24

Re: Unusually high memory usage

$ free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       452Mi        14Gi       2.0Mi        64Mi        14Gi
Swap:          39Gi          0B        39Gi

With just 4 Tasks(init, login, bash, free) and dropped cache

Last edited by BenniTec (2021-02-09 13:40:24)

Offline

#4 2021-02-10 01:33:00

mpan
Member
Registered: 2012-08-01
Posts: 1,585
Website

Re: Unusually high memory usage

I see no point in dropping caches: that will only slow down your system and slightly shorten your HDD life. Therefore I skip that part.

Aside from 452MiB not looking like anything to be concerned about, in particular with 15GiB RAM, are you sure there are only 4 processes? That sounds extremely unlikely. What is the output of:

ps -e | wc -l

Paperclips in avatars? | Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#5 2021-02-10 03:40:57

BenniTec
Member
Registered: 2020-09-11
Posts: 24

Re: Unusually high memory usage

If I exit the desktop and kill all processes and daemons (except init, login, bash, htop) visible in htop with killall and systemctl --stop,
ps -e shows me still 250 processes running. It seems like almost all of them are for kernel tasks.
Currently in desktop I have 352 tasks. Btw I dropped caches just to check if those were the problem, which they are not.

    PID TTY          TIME CMD
      1 ?        00:00:04 systemd
      2 ?        00:00:00 kthreadd
      3 ?        00:00:00 rcu_gp
      4 ?        00:00:00 rcu_par_gp
      6 ?        00:00:00 kworker/0:0H-events_highpri
      9 ?        00:00:00 mm_percpu_wq
     10 ?        00:00:00 rcu_tasks_kthre
     11 ?        00:00:00 rcu_tasks_rude_
     12 ?        00:00:00 rcu_tasks_trace
     13 ?        00:02:39 ksoftirqd/0
     14 ?        00:00:00 rcuc/0
     15 ?        00:02:26 rcu_preempt
     16 ?        00:00:00 rcub/0
     17 ?        00:00:00 migration/0
     18 ?        00:00:00 idle_inject/0
     19 ?        00:00:00 cpuhp/0
     20 ?        00:00:00 cpuhp/1
     21 ?        00:00:00 idle_inject/1
     22 ?        00:00:00 migration/1
     23 ?        00:00:00 rcuc/1
     24 ?        00:00:02 ksoftirqd/1
     26 ?        00:00:00 kworker/1:0H-events_highpri
     27 ?        00:00:00 cpuhp/2
     28 ?        00:00:00 idle_inject/2
     29 ?        00:00:00 migration/2
     30 ?        00:00:00 rcuc/2
     31 ?        00:00:14 ksoftirqd/2
     33 ?        00:00:00 kworker/2:0H-kblockd
     34 ?        00:00:00 cpuhp/3
     35 ?        00:00:00 idle_inject/3
     36 ?        00:00:00 migration/3
     37 ?        00:00:00 rcuc/3
     38 ?        00:00:01 ksoftirqd/3
     40 ?        00:00:00 kworker/3:0H-kblockd
     41 ?        00:00:00 cpuhp/4
     42 ?        00:00:00 idle_inject/4
     43 ?        00:00:00 migration/4
     44 ?        00:00:00 rcuc/4
     45 ?        00:00:05 ksoftirqd/4
     47 ?        00:00:00 kworker/4:0H-events_highpri
     48 ?        00:00:00 cpuhp/5
     49 ?        00:00:00 idle_inject/5
     50 ?        00:00:00 migration/5
     51 ?        00:00:00 rcuc/5
     52 ?        00:00:02 ksoftirqd/5
     54 ?        00:00:00 kworker/5:0H-events_highpri
     55 ?        00:00:00 cpuhp/6
     56 ?        00:00:00 idle_inject/6
     57 ?        00:00:00 migration/6
     58 ?        00:00:00 rcuc/6
     59 ?        00:00:05 ksoftirqd/6
     61 ?        00:00:00 kworker/6:0H-events_highpri
     62 ?        00:00:00 cpuhp/7
     63 ?        00:00:00 idle_inject/7
     64 ?        00:00:00 migration/7
     65 ?        00:00:00 rcuc/7
     66 ?        00:00:00 ksoftirqd/7
     68 ?        00:00:00 kworker/7:0H-kblockd
     69 ?        00:00:00 cpuhp/8
     70 ?        00:00:00 idle_inject/8
     71 ?        00:00:00 migration/8
     72 ?        00:00:00 rcuc/8
     73 ?        00:00:25 ksoftirqd/8
     75 ?        00:00:00 kworker/8:0H-events_highpri
     76 ?        00:00:00 cpuhp/9
     77 ?        00:00:00 idle_inject/9
     78 ?        00:00:00 migration/9
     79 ?        00:00:00 rcuc/9
     80 ?        00:00:04 ksoftirqd/9
     82 ?        00:00:00 kworker/9:0H-kblockd
     83 ?        00:00:00 cpuhp/10
     84 ?        00:00:00 idle_inject/10
     85 ?        00:00:00 migration/10
     86 ?        00:00:00 rcuc/10
     87 ?        00:00:07 ksoftirqd/10
     89 ?        00:00:00 kworker/10:0H-kblockd
     90 ?        00:00:00 cpuhp/11
     91 ?        00:00:00 idle_inject/11
     92 ?        00:00:00 migration/11
     93 ?        00:00:00 rcuc/11
     94 ?        00:00:01 ksoftirqd/11
     95 ?        00:00:00 kworker/11:0-events
     96 ?        00:00:00 kworker/11:0H-kblockd
     97 ?        00:00:00 cpuhp/12
     98 ?        00:00:00 idle_inject/12
     99 ?        00:00:00 migration/12
    100 ?        00:00:00 rcuc/12
    101 ?        00:00:15 ksoftirqd/12
    103 ?        00:00:00 kworker/12:0H-events_highpri
    104 ?        00:00:00 cpuhp/13
    105 ?        00:00:00 idle_inject/13
    106 ?        00:00:00 migration/13
    107 ?        00:00:00 rcuc/13
    108 ?        00:00:05 ksoftirqd/13
    110 ?        00:00:00 kworker/13:0H-kblockd
    111 ?        00:00:00 cpuhp/14
    112 ?        00:00:00 idle_inject/14
    113 ?        00:00:00 migration/14
    114 ?        00:00:00 rcuc/14
    115 ?        00:00:08 ksoftirqd/14
    117 ?        00:00:00 kworker/14:0H-events_highpri
    118 ?        00:00:00 cpuhp/15
    119 ?        00:00:00 idle_inject/15
    120 ?        00:00:00 migration/15
    121 ?        00:00:00 rcuc/15
    122 ?        00:00:04 ksoftirqd/15
    124 ?        00:00:00 kworker/15:0H-kblockd
    125 ?        00:00:00 kdevtmpfs
    126 ?        00:00:00 netns
    127 ?        00:00:00 kauditd
    128 ?        00:00:01 kworker/14:1-events
    131 ?        00:00:00 khungtaskd
    132 ?        00:00:00 oom_reaper
    133 ?        00:00:00 writeback
    134 ?        00:00:00 kcompactd0
    135 ?        00:00:00 ksmd
    136 ?        00:00:02 khugepaged
    141 ?        00:00:00 kworker/6:1-events
    156 ?        00:00:00 kintegrityd
    157 ?        00:00:00 kblockd
    158 ?        00:00:00 blkcg_punt_bio
    160 ?        00:00:00 ata_sff
    161 ?        00:00:00 edac-poller
    162 ?        00:00:00 devfreq_wq
    163 ?        00:00:00 watchdogd
    164 ?        00:00:00 kworker/15:1-mm_percpu_wq
    167 ?        00:00:00 kworker/1:1H-kblockd
    168 ?        00:00:00 irq/25-AMD-Vi
    170 ?        00:00:00 kswapd0
    172 ?        00:00:00 kthrotld
    173 ?        00:00:00 kworker/3:1-events
    177 ?        00:00:00 kworker/11:1-events
    178 ?        00:00:00 kworker/12:1-mm_percpu_wq
    180 ?        00:00:00 acpi_thermal_pm
    181 ?        00:00:00 amd_iommu_v2
    183 ?        00:00:00 nvme-wq
    184 ?        00:00:00 nvme-reset-wq
    185 ?        00:00:00 nvme-delete-wq
    189 ?        00:00:00 kworker/5:1H-kblockd
    190 ?        00:00:00 ipv6_addrconf
    200 ?        00:00:00 kstrp
    205 ?        00:00:00 zswap1
    206 ?        00:00:00 zswap1
    207 ?        00:00:00 zswap-shrink
    208 ?        00:00:00 kworker/u33:0-rb_allocator
    209 ?        00:00:00 charger_manager
    210 ?        00:00:00 kworker/2:1H-kblockd
    211 ?        00:00:00 kworker/3:1H-kblockd
    225 ?        00:00:00 kworker/8:1H-kblockd
    238 ?        00:00:00 kworker/6:1H-kblockd
    243 ?        00:00:00 kworker/15:1H-kblockd
    252 ?        00:00:00 kworker/11:1H-kblockd
    253 ?        00:00:00 kworker/13:1H-kblockd
    254 ?        00:00:00 kworker/7:1H-kblockd
    256 ?        00:00:00 kworker/9:1H-kblockd
    259 ?        00:00:00 kworker/4:1H-kblockd
    261 ?        00:00:00 kdmflush
    262 ?        00:00:00 kdmflush
    265 ?        00:00:00 kworker/12:1H-kblockd
    269 ?        00:00:00 kworker/0:1H-kblockd
    280 ?        00:00:01 jbd2/dm-0-8
    281 ?        00:00:00 ext4-rsv-conver
    285 ?        00:00:00 kworker/14:1H-kblockd
    294 ?        00:00:00 kworker/8:3-events
    310 ?        00:00:00 kworker/10:1H-kblockd
    334 ?        00:00:00 kworker/9:2-events
    354 ?        00:00:00 kworker/10:2-mm_percpu_wq
    393 ?        00:00:00 irq/61-UNIW0001
    412 ?        00:00:00 tpm_dev_wq
    442 ?        00:00:00 kworker/7:2-events
    446 ?        00:00:00 cryptd
    452 ?        00:00:00 cfg80211
    474 ?        00:00:01 irq/67-iwlwifi:
    475 ?        00:00:00 irq/68-iwlwifi:
    476 ?        00:00:00 irq/69-iwlwifi:
    477 ?        00:00:00 irq/70-iwlwifi:
    478 ?        00:00:00 irq/71-iwlwifi:
    479 ?        00:00:00 irq/72-iwlwifi:
    480 ?        00:00:00 irq/73-iwlwifi:
    481 ?        00:00:00 irq/74-iwlwifi:
    482 ?        00:00:00 irq/75-iwlwifi:
    483 ?        00:00:00 irq/76-iwlwifi:
    484 ?        00:00:00 irq/77-iwlwifi:
    485 ?        00:00:00 irq/78-iwlwifi:
    486 ?        00:00:00 irq/79-iwlwifi:
    487 ?        00:00:00 irq/80-iwlwifi:
    488 ?        00:00:00 irq/81-iwlwifi:
    489 ?        00:00:00 irq/82-iwlwifi:
    497 ?        00:00:00 kworker/13:2-events
    537 ?        00:00:00 kworker/u33:2-hci0
    546 ?        00:00:00 ttm_swap
    548 ?        00:01:59 gfx
    549 ?        00:00:00 comp_1.0.0
    550 ?        00:00:00 comp_1.1.0
    551 ?        00:00:00 comp_1.2.0
    552 ?        00:00:00 comp_1.3.0
    553 ?        00:00:00 comp_1.0.1
    554 ?        00:00:00 comp_1.1.1
    555 ?        00:00:00 comp_1.2.1
    556 ?        00:00:00 comp_1.3.1
    557 ?        00:00:01 sdma0
    558 ?        00:00:00 vcn_dec
    559 ?        00:00:00 vcn_enc0
    560 ?        00:00:00 vcn_enc1
    561 ?        00:00:00 jpeg_dec
    693 ?        00:00:00 nv_queue
    694 ?        00:00:00 nv_queue
    706 ?        00:00:00 nvidia-modeset/
    707 ?        00:00:00 nvidia-modeset/
    720 ?        00:00:00 card0-crtc0
    721 ?        00:00:00 card0-crtc1
    722 ?        00:00:00 card0-crtc2
    723 ?        00:00:00 card0-crtc3
    743 ?        00:00:00 kmemstick
   1009 ?        00:00:00 ecryptfs-kthrea
   3802 ?        00:00:00 kworker/1:1-events
   3812 ?        00:00:00 kworker/7:0-events
   3819 ?        00:00:00 kworker/4:0-events
   3882 ?        00:00:00 kworker/2:0-events
   4040 ?        00:00:00 kworker/12:0-events
  11439 ?        00:00:00 kworker/9:1-cgroup_destroy
  12106 ?        00:00:00 UVM global queu
  12107 ?        00:00:00 UVM deferred re
  12108 ?        00:00:00 UVM Tools Event
  17301 ?        00:00:00 kworker/6:0-events
  17539 ?        00:00:00 kworker/13:0
  17550 ?        00:00:00 kworker/3:3-events
  18027 ?        00:00:00 kworker/5:5-events
  18705 ?        00:00:00 kworker/2:2-events
  19051 ?        00:00:00 kworker/15:2
  22704 ?        00:00:18 kworker/u32:0-events_power_efficient
  34432 ?        00:00:03 kworker/u32:1-events_unbound
  36287 ?        00:00:00 kworker/0:2-events
  36786 ?        00:00:00 kworker/1:0-events
  36809 ?        00:00:00 kworker/u32:3-events_power_efficient
  36820 ?        00:00:00 kworker/4:2-events
  36861 ?        00:00:00 kworker/10:1-cgroup_destroy
  36922 ?        00:00:00 login
  36927 tty2     00:00:00 bash
  36946 ?        00:00:00 kworker/12:2
  37108 ?        00:00:00 kworker/0:1-events
  37125 ?        00:00:00 kworker/14:0-cgroup_destroy
  37273 ?        00:00:00 kworker/5:0-events
  37403 ?        00:00:00 kworker/8:1-events
  37405 tty3     00:00:00 agetty
  37538 ?        00:00:00 kworker/7:1-events
  37689 ?        00:00:00 kworker/8:0
  37690 ?        00:00:00 kworker/1:2-mm_percpu_wq
  37691 tty2     00:00:00 ps

Last edited by BenniTec (2021-02-10 03:41:50)

Offline

#6 2021-02-10 07:18:26

mpan
Member
Registered: 2012-08-01
Posts: 1,585
Website

Re: Unusually high memory usage

The setup seems more than ascetic, missing even such basic components as systemd-journald and dbus. But I can’t discuss with data: indeed there are 4 processes.

I still can’t see how that microscopic amount of memory usage is a problem, but if you’re wishing to dig into it: htop alone should give an overview of what processes uses how much RAM: the RES column.⁽¹⁾ If that doesn’t explain the usage, see /proc/meminfo: in particular the Slab and SUnreclaimable rows. Even more detailed information is in /proc/slabinfo. Introduction to slabs and more in-depth description. But I blieve that’s overkill.

____
⁽¹⁾ Though term “memory used” is ambiguous. There is no single measure and e.g. RAM usage is described by both RES and SHR with at least a few methods of interpreting those.

Last edited by mpan (2021-02-10 07:19:29)


Paperclips in avatars? | Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#7 2021-02-10 07:51:57

BenniTec
Member
Registered: 2020-09-11
Posts: 24

Re: Unusually high memory usage

I killed systemd-journald, dbus etc. on purpose to eliminate possible memory leaks in said programs. Normally they are running.
450MiB RAM used when doing literally nothing is too high. One month ago the memory usage would be less than 100MiB and with Cinnamon about 800MiB.
On startup it's like 1.5GGiB RAM usage only with Cinnamon running. Using Xfce results in a somewhat same memory usage as Cinnamon.
With Chromium the usage is at 3.3GiB. It's literally double or worse than what it was a month ago.
I don't know what's causing this. I only know for certain that Hugepages and a memory leaks in systemd or other programs is not the problem.

Offline

#8 2021-02-10 08:54:45

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,082

Re: Unusually high memory usage

And if you downgrade the kernel to "a month ago" ? If you can't trace it to an userspace program, the kernel would be the first thing springing to mind that does indeed have a big potential for regressions.

Online

#9 2021-02-11 04:57:19

BenniTec
Member
Registered: 2020-09-11
Posts: 24

Re: Unusually high memory usage

Unfortunately even Linux 5.9.14 has the same issue.
I tried compiling the kernel myself but for some reason it freezes when it tries to load the initramfs.
Btw I successfully configured /etc/mkinitcpio.d/linux-custom.preset, so that's not the problem.
I'm gonna see, if it also happens in a VM.

Offline

#10 2021-02-11 05:07:20

BenniTec
Member
Registered: 2020-09-11
Posts: 24

Re: Unusually high memory usage

No issues in a VM, 750MiB RAM usage with a similar configuration (Cinnamon) vs 1100MiB on host after startup.

Offline

#11 2021-02-11 05:13:05

BenniTec
Member
Registered: 2020-09-11
Posts: 24

Re: Unusually high memory usage

Starting the host with init=/bin/bash I get 200MiB of RAM usage.
In a virtual machine I get 100MiB.
Something is really fucking up my installation if it even happens in single user mode.
So those are not the issues: kernel, systemd, memory leak in other programs
I really don't know where to search and I really don't want to reinstall Arch.

Btw I use LVM2 on both host and VM.
I'm gonna try to restore my backup from 2021-01-18.

Last edited by BenniTec (2021-02-11 05:17:48)

Offline

#12 2021-02-11 05:34:17

BenniTec
Member
Registered: 2020-09-11
Posts: 24

Re: Unusually high memory usage

Even a backup doesn't change things. Something is reeealy messed up.

After installing Arch on a seperate HDD I still get 200MiB with init=/bin/bash but only about 800MiB in Cinnamon.
With Chromium running I get 1.5GiB.

Last edited by BenniTec (2021-02-11 06:19:31)

Offline

#13 2021-02-11 05:47:03

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Unusually high memory usage

There is an edit button on every post: learn how to use it.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB