# 877 out of 1gb (1024mb) ram? How to optimize for more?

## vexatious

Wondering what approach I should take to make all my ram available after boot.

Running htop after boot shows I only have a total of 877MB of ram available? How can I make my full 1024mb available or at least close to that? I have no initrd image.

In arch linux after a boot htop shows 1004mb available which is quite abit more and it's a stock kernel (2.6.35.x).

Some tips on optimizing boot time would be nice too!

Thanks  :Smile: 

----------

## audiodef

This I'd also like to know, so I'm going to follow along...

----------

## adramalech707

i have the same issue i have 4gb of ram and only shows 3.5 on a ~amd64 build...it has to be the kernel using so much ram and only allocating for the kernel to use not for the userspace....

that is atleast what i found with conky...so it should have like 100mb of space for kernel allocation...

run dmesg | grep memory and it will show u how much is available for use and how much, in () is reserved for kernel.....

----------

## vexatious

I think it's gotta be some settings in the kernel .config. I did a make localmodconfig to use only the required modules for my system and I double checked to make sure the right ones were indeed selected and got rid of a few that weren't needed. I just think it shoulda set the same setting that my arch linux install has (installed gentoo from chroot in Arch) for whatever is reserving memory if indeed that is were this issue stems from, and not just the modules...

It'd be great if someone smarter than me would provide an answer to this. If arch linux leaves over 1000mb out of 1024mb available then how does it do it? Arch linux is using a ram image to top it off...

877 out of 1024mb is just too much reserved for my kinda system. You can do so much with 147mb and what about systems that only have 32-128 mb of ram? Even if I had 200gb's of ram that's still too much reserved I.M.O. I wan't it all for the software I use (games, internet, music, compiling, etc.). If it's a cache reserve or something like that then I'd rather leave it at like 8mb or something (maybe less). Maybe even turn it off! lol 

I'm a desktop user-gamer so I'm definately not running something like a network server, or anything that needs all the cache it can get. If I decide to play Doom 3 it'd definately run better with more ram available as with any other big games.

I'm forced to startx straight into a game (no window manager), and I know with 140+ mb of ram extra available it would help alot in many cases.

----------

## aCOSwt

What is the output of

```
# free
```

 after boot.

(Take the line +/- buffers / cache)

Mine (x86_64) is saying 40M used only and I bet that it would be even less on an x86.

----------

## darklegion

You are probably using the wrong VMSPLIT/HIGHMEM option. I don't use a 32 bit kernel anymore, but one of the options will result in a loss of memory when using 1GB ram. I can't remember the exact option, but it won't be the default. I think the default says "up to 1GB of ram" but as you've found, it doesn't use all of that 1GB.

EDIT: I just remembered that I have a gentoo netbook with a 32bit kernel. You have a few options:

1) Enable CONFIG_HIGHMEM4G (4GB High Memory Support)

If I remember right, this might have some issues. The documentation does say that between 1 and 4GB of ram is fine, though.

2) Enable any of the VMSPLIT options except the default. I'm not sure which is optimal, but I'd say 1GB lowmem is your best bet (VMSPLIT_3G_OPT)

I'm using VMSPLIT_2G, but this is with a 2GB system.

I think you might need to enable some additional options in order to see the memory split option. I can't remember which, though.

----------

## maxime1986

I confirm what darklegion said :

you have to select the CONFIG_HIGHMEM4G option.

----------

## fau

This is what I've googled:

http://kerneltrap.org/node/2450

----------

## swanson

Apply the following patch to allow selecting the VMSPLIT_3G_OPT memory option as it's normally only available on embedded.

```
--- linux/arch/x86/Kconfig      2008-10-10 09:26:01.000000000 +0100

+++ linux/arch/x86/Kconfig      2008-11-01 11:16:48.000000000 +0000

@@ -875,8 +875,8 @@

 choice

        depends on EXPERIMENTAL

-       prompt "Memory split" if EMBEDDED

-       default VMSPLIT_3G

+       prompt "Memory split"

+       default VMSPLIT_3G_OPT

        depends on X86_32

        help

          Select the desired split between kernel and user memory.

@@ -895,7 +895,7 @@

          option alone!

        config VMSPLIT_3G

-               bool "3G/1G user/kernel split"

+               bool "3G/1G user/kernel split (with 896Mb low memory)"

        config VMSPLIT_3G_OPT

                depends on !X86_PAE

                bool "3G/1G user/kernel split (for full 1G low memory)"
```

----------

## vexatious

Swanson your patch worked! Thank you so much! I had to manually patch the file by hand but it worked great!

I'm now seeing 1001mb out of 1024 so I'm definately happy with that. I have 4gb ram support disabled so I'm not sure if that would change anything. I'm running a 775dual-vsta asrock motherboard. So I have P.A.E. enabled, 1g/3g usr/kernel split and memory model (flat memory). 

I also changed preemption model to (preemptible kernel (low latency desktop)) which seems alot better! I'm not kidding but I was compiling wine, ffmpeg and mame simultaneously and google-chrome still gave me instant response while browsing the web! Yes google-chrome is alot faster than firefox but still this is on a single core gimped pentium 4 prescott with only 512kb of cache (celeron D @ 3.33ghz lga 775). I don't know how the preemption model works or what it does but this is a huge advantage for me as a single core user with smp disabled!

Sorry for the late response but I just want people to know that my problem was solved with swanson's post. Thanks again swanson!

If there's any other tricks to squeeze more memory out it'd be nice to know some lol

----------

## vexatious

Ok now something else sucks... Now whenever I run wine it says "killed"... That's it. I can do winecfg and I get "killed". I deleted the /home/usr/.wine directory and still the same thing...

with strace I get

bash-4.1# strace wine

execve("/usr/bin/wine", ["wine"], [/* 50 vars */] <unfinished ...>

+++ killed by SIGKILL +++

Killed

It seems related to this bug http://bugs.winehq.org/show_bug.cgi?id=5407 . LOL yeah it's gotta be the same sort of issue since I changed the memory split option... Damn. Should I start another thread or could someone post a solution here? ...

EDIT: some freakin guy on the last post here http://kerneltrap.org/mailarchive/linux-kernel/2007/4/28/83281/thread says he can run wine just fine with the same memory split option I'm using... OMG lol! So what's the deal here...

----------

## energyman76b

don't touch highmem. If you want to access the full gb, go 64bit.

If you only can access 3.5gb of 4 on a 64bit system, get a mobo without a crappy bios.

Enabling highmen to get some nice number hurts a lot. Don't do it.

And never ever touch that VMSPLIT options.

----------

## chithanh

In kernel 2.4 times, it was recommended to not enable HIGHMEM_4G on 1 GB RAM (and lose 128 MB of usable RAM) systems because of the performance hit. But things have improved since. Still, highmem is some kind of fast swap space and should be used only when going 64 bit is not possible/desirable.

Regarding the VMSPLIT, this is indeed best left alone. Not only wine has problems with non-default setting, also many external kernel modules (eg. vmware).

If you have a 64 bit system and cannot access more than 3.5 GB, then check in your BIOS if it has a memory remap option.

----------

## vexatious

I can't run 64 bit.http://ark.intel.com/Product.aspx?id=27114

I don't even have highmem 4gb option enabled... Even before I changed the vmsplit option it wasn't enabled and I still lost over 140mb of ram!

I only have 1gb of ram. That's why I started this thread in the first place.

I aint rich either.

So basically I'm out of luck unless there's another way to show my 1gb of ram available (which still isn't fully available but close enough). Or I could go back to 877mb of ram available and run wine with no problems...

My system runs so much better too (yeah except for wine!)!It sucks to be me I guess...Isn't there a patch for wine or something for this? I don't wanna start a new thread but...

----------

## energyman76b

are those 140mb difference really so much? You are wasting performance with those stuff enabled (and loose wine and whatelse).

Besides - I am not rich either, but a hardware upgrade once a year is still possible. CPUs aren't expensive. Especially if you don't buy intel.

----------

