Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
High RAM use on cold boot
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Hammett
Apprentice
Apprentice


Joined: 26 Jan 2005
Posts: 240
Location: Barcelona, Catalonia

PostPosted: Sun Sep 01, 2024 3:31 pm    Post subject: High RAM use on cold boot Reply with quote

Hi all,

I am seeing a high use of RAM on cold boot. Once I boot the system, I am seeing around 920MB of RAM usage.

I do not have anything fancy loading up, and my window manager is DWM, which should be fairly light. I would expect the RAM use to be around 250-300MB, but not triple that.

This is the services I have running:
Code:
Runlevel: boot
 hwclock                                                           [  started  ]
 modules                                                           [  started  ]
 fsck                                                              [  started  ]
 root                                                              [  started  ]
 mtab                                                              [  started  ]
 swap                                                              [  started  ]
 localmount                                                        [  started  ]
 systemd-tmpfiles-setup                                            [  started  ]
 seedrng                                                           [  started  ]
 hostname                                                          [  started  ]
 sysctl                                                            [  started  ]
 bootmisc                                                          [  started  ]
 acpid                                                             [  started  ]
 zram-init                                                         [  started  ]
 termencoding                                                      [  started  ]
 keymaps                                                           [  started  ]
 save-keymaps                                                      [  started  ]
 procfs                                                            [  started  ]
 binfmt                                                            [  started  ]
 iptables                                                          [  started  ]
 save-termencoding                                                 [  started  ]
 elogind                                                           [  started  ]
 alsasound                                                         [  started  ]
 net.lo                                                            [  started  ]
 loopback                                                          [  started  ]

Code:
Runlevel: default
 syslog-ng                                                         [  started  ]
 dbus                                                              [  started  ]
 net.eno1                                                          [  started  ]
 mpd                                                               [  started  ]
 lm_sensors                                                        [  started  ]
 dcron                                                             [  started  ]
 fancontrol                                                        [  started  ]
 local                                                             [  started  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
 display-manager-setup                                             [  started  ]
Dynamic Runlevel: manual


Aside from that I have the following programs upon boot:
- pipewire
- wireplumber
- mpd
- picom
- easyeffects

And this is the output from "free -h"
Code:
               total        used        free      shared  buff/cache   available
Mem:            15Gi       1.4Gi        13Gi        45Mi       884Mi        14Gi
Swap:           20Gi          0B        20Gi

*Note the use of RAM and buff/cache is higher due to the browser, but "used" on cold boot is around 920MB and "buff/cache" is around 420MB, which I think is pretty high also for the system just being started

What else could be wrong? Should I share my kernel config as well?

Thank you
_________________
I don't fear the people. I fear the demon inside them.
Back to top
View user's profile Send private message
user
Apprentice
Apprentice


Joined: 08 Feb 2004
Posts: 209

PostPosted: Sun Sep 01, 2024 9:24 pm    Post subject: Reply with quote

Hi Hammett,
second of all main memory rules: using existing main memory is better then prevent to use free main memory in any case.

As you find it out already, your main memory is currently mostly used for buffer/cache. That is fine, it can reduce latency on slower IO paths.
Don't worry, used buffer/cache memory will be freed/reduced if an application demand more main memory as currently unused.

To find most memory consuming processes, try this shell command and dive into memory design topic of "rss" vs "size" vs "vsz".
Code:
# ps -eo pmem,rss,size,vsz,pid,ucmd --sort=-rss | head -10
Back to top
View user's profile Send private message
Hammett
Apprentice
Apprentice


Joined: 26 Jan 2005
Posts: 240
Location: Barcelona, Catalonia

PostPosted: Mon Sep 02, 2024 6:38 am    Post subject: Reply with quote

user wrote:
Hi Hammett,
second of all main memory rules: using existing main memory is better then prevent to use free main memory in any case.

As you find it out already, your main memory is currently mostly used for buffer/cache. That is fine, it can reduce latency on slower IO paths.
Don't worry, used buffer/cache memory will be freed/reduced if an application demand more main memory as currently unused.

To find most memory consuming processes, try this shell command and dive into memory design topic of "rss" vs "size" vs "vsz".
Code:
# ps -eo pmem,rss,size,vsz,pid,ucmd --sort=-rss | head -10


Hi user,
Thanks for the reply. I am very happy for Linux to use as much memory for buffers/caches as it needs, and I agree RAM is there to be used, but I think you are missing the point.

In cold boot, I should not be using that much RAM and I am trying to figure out why this is happening and what processes are using it.

Thank you for the one-liner, I will have a look!
_________________
I don't fear the people. I fear the demon inside them.
Back to top
View user's profile Send private message
user
Apprentice
Apprentice


Joined: 08 Feb 2004
Posts: 209

PostPosted: Mon Sep 02, 2024 1:02 pm    Post subject: Reply with quote

Hammett wrote:

In cold boot, I should not be using that much RAM and I am trying to figure out why this is happening and what processes are using it.

Thank you for the one-liner, I will have a look!

What is your assumption that buffer/cache is unexpected high after initial cold boot? Maybe program X reads MiB of content during initial start?
Drop file cache and check remained buffer/cache:
Code:
free && sync && echo 3 > /proc/sys/vm/drop_caches && free

Configured zram-init is a good candidate to still consume buffer/cache.
Back to top
View user's profile Send private message
Hammett
Apprentice
Apprentice


Joined: 26 Jan 2005
Posts: 240
Location: Barcelona, Catalonia

PostPosted: Mon Sep 02, 2024 2:45 pm    Post subject: Reply with quote

user wrote:
Hammett wrote:

In cold boot, I should not be using that much RAM and I am trying to figure out why this is happening and what processes are using it.

Thank you for the one-liner, I will have a look!

What is your assumption that buffer/cache is unexpected high after initial cold boot? Maybe program X reads MiB of content during initial start?
Drop file cache and check remained buffer/cache:
Code:
free && sync && echo 3 > /proc/sys/vm/drop_caches && free

Configured zram-init is a good candidate to still consume buffer/cache.


That is why I posted the init scripts + what I load upon boot. I do not see anything that requires that much data to be read. Not mpd, not easyeffects, not mpd, not the nvidia module, not pipewire or wireplumber... Is there a way to check what reads that amount of data?

I am also looking at the zram-init, but that is only for /var/tmp/portage, which is empty upon boot (I checked). I even removed nfs client thinking it might cache some files of the network drive....
_________________
I don't fear the people. I fear the demon inside them.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9757
Location: almost Mile High in the USA

PostPosted: Mon Sep 02, 2024 6:03 pm    Post subject: Reply with quote

Also keep in mind the more RAM you have, the more RAM the computer will waste (page tables is a biggie but there's more than just this), so if you're concerned about memory usage, remove hardware RAM and your consumption will go down.

Yes this was tongue-in-cheek, so again don't worry about consumption until you run out... Those with less RAM have to worry about it more (though they have the benefit of having less page table consumption...).
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Hammett
Apprentice
Apprentice


Joined: 26 Jan 2005
Posts: 240
Location: Barcelona, Catalonia

PostPosted: Sun Sep 08, 2024 12:06 pm    Post subject: Reply with quote

user wrote:
Hammett wrote:

In cold boot, I should not be using that much RAM and I am trying to figure out why this is happening and what processes are using it.

Thank you for the one-liner, I will have a look!

What is your assumption that buffer/cache is unexpected high after initial cold boot? Maybe program X reads MiB of content during initial start?
Drop file cache and check remained buffer/cache:
Code:
free && sync && echo 3 > /proc/sys/vm/drop_caches && free

Configured zram-init is a good candidate to still consume buffer/cache.


Finally found out that zram-init was the culprit. Even though I had it set it up only for /var/tmp/portage, it was consuming RAM. Once uninstalled, the cold boot RAM is at 420MB of RAM
_________________
I don't fear the people. I fear the demon inside them.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum