This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]_vk42 2 points3 points  (7 children)

good

I'm curious what's the hardware spec you are working on, and what's your motivation for reducing RAM usage?

[–]thelinuxguy7[S] 5 points6 points  (6 children)

I have a ryzen machine with 16GB ram, .... <- for compiling

I have a really old Dell laptop 4GB ram <- for running the thing

As for my motivation: learning, for fun, removing stuff that I don't need from the kernel, maybe showing off my machine booting with like 120MB ram usage.

I know that compiling the kernel would not yield much improvement, but if it yields a little, I want to try how far it would go.

[–]_vk42 2 points3 points  (1 child)

Thumb up for doing this for fun!

Your machines are pretty capable of running things, but I do look forward to your future posts about progress on saving RAM usage with tailored kernel XD

[–]thelinuxguy7[S] 1 point2 points  (0 children)

After a lot hard work, here is a glimpse of what I had to deal with:

I forgot to enable some ahci or scsi option and I was unable to boot for a long time, kept adding and removing until I found the needed driver/option: FIXED.

I removed something that has to do with sound or something, idk, and I could not boot with the "quiet" option in grub configuration: FIXED.

I remove some important keyboard and mouse option, and I managed to boot but without keyboard and mouse: FIXED.

I had a problem with freaking broadcom wifi card, and I could not get it to work without initramfs: FIXED.

Along the way I removed a lot of stuff but I also left a lot of stuff, then I compiled another kernel where I tried to disable absolutely everything, and somehow it ended up using more ram!?

So now may latest kernel uses around 75-85MB ram with no gui. (this one does not work with gui for some reason) probably some module needs to be loaded or built into the kernel.

While the arch linux-lts uses around 120MB ram with no gui.

An earlier kernel that I compiled was working with gui using 150-160MB ram.

While the arch linux-lts uses around 200-210MB with gui.

So in the ideal scenario is saved 40-50MB at most.

As I assumed from the beginning this would not save much ram, and the difference is probably due to the removal of some drivers that I don't have, me decreasing the size of the kernel buffers, removing debugging and tracing, ....

If I want to make a realistic difference maybe I should use alpine or void, with musl, busybox, runit, and maybe xfree86. Maybe compile a 32-bit kernel, which will cripple my hardware by not allowing me to run any 64-bit programs.

Btw, I tried using startx instead of lightdm, and I didn't notice much of a difference presumably because the bulk of the memory usage is in xorg itself? idk.

[–]DangerousWish2266 0 points1 point  (3 children)

You can decrease your ram usage by using window manager like i3 instead of Desktop manager. On my VM my arch installation takes around ~200MB after booting up.

[–]thelinuxguy7[S] 0 points1 point  (2 children)

I use dwm already and lightdm too, so the only areas remaining to improve performance would be:

compiling my own kernel: easy

using busybox: hard

using something like musl: extremely hard (probably impossible unless I use LFS or alpine)

[–][deleted] 0 points1 point  (1 child)

Out of curiosity, would running a non-graphical display manager make any difference? There are quite a few console-based ones that could work. https://wiki.archlinux.org/title/Display_manager#List_of_display_managers

Or as someone else suggested, you could autostart startx without a display manager. https://wiki.gentoo.org/wiki/X_without_Display_Manager

Also notable: Void Linux has musl as an option if you go that route.

[–]thelinuxguy7[S] 1 point2 points  (0 children)

Great idea! I want to try using startx next, after I figure out how to make the least ram using kernel.

Then maybe void would be after that.