# x86_64 System with 4GB Ram only seeing 3873 MB

## OrangeToque

Hello,

I know that there have been similar posts, however I have not been able to find a post that explicitly deals with the amd64 arch.

Here is the problem ::

free reports ::

```
$> free -m

             total       used       free     shared    buffers     cached

Mem:          3873       3843         30          0          0       2351

-/+ buffers/cache:       1491       2382

Swap:         1937          0       1937
```

but cat /proc/mtrr reports ::

```
$> cat /proc/mtrr

reg00: base=0x80000000 (2048MB), size=2048MB: uncachable, count=1

reg01: base=0x00000000 (   0MB), size=4096MB: write-back, count=1

reg02: base=0x100000000 (4096MB), size=1024MB: write-back, count=1

reg03: base=0x140000000 (5120MB), size= 512MB: write-back, count=1

reg04: base=0x160000000 (5632MB), size= 256MB: write-back, count=1

reg05: base=0x170000000 (5888MB), size= 128MB: write-back, count=1

reg06: base=0x178000000 (6016MB), size=  64MB: write-back, count=1

```

A few other relevant details ::

My bios reports 4032 @ post,

memtest86+ report 4031 cached + 508K RsvdMem

I am using amd64 arch... 

```
$> uname -a

Linux revolver 2.6.23-gentoo-r2 #1 SMP Mon Nov 19 17:56:29 MST 2007 x86_64 Intel(R) Core(TM)2 Quad CPU Q6700 @ 2.66GHz GenuineIntel GNU/Linux
```

I should have 4032Mb of ram but I only see 3873Mb!

So I'm wondering why my system is only 3873Mb of ram not 4032Mb?

I have the enable memory remap option set in my bios; it was required for the bios to successfully post 4032Mb of ram.

Any thoughts... or is anyone having similar issues?

Why is the system ignoring  159Mb (4032 - 3873) of memory?

----------

## Jenk

Are you sure you haven't got a config option mixed up somewhere? My 2GB box reports:

```
 # free

             total       used       free     shared    buffers     cached

Mem:       2036760     463708    1573052          0      15592     168768

-/+ buffers/cache:     279348    1757412

Swap:      1052248          0    1052248

```

I would also be concerned with only 30bytes of RAM free..

----------

## CoolBeer

Hmm? How do you get that to be only 30MB free?

I read it as atleast 2382MB free.

My box reports:

```

:~$ free -m

             total       used       free     shared    buffers     cached

Mem:          2014       1998         16          0       1491        119

-/+ buffers/cache:        387       1627

Swap:            0          0          0

```

Which in my book is about 1627MB free.

EDIT: Removed hostname/username (can't be paranoid enough  :Razz: )

----------

## OrangeToque

Correct, there was in fact 2382 Mb free.   The issue isn't that I do not have any RAM available, but rather that my system does not recognize all 4032 Mb of system memory.

----------

## PaulBredbury

Could be a memory hole caused by the BIOS, for its own needs or bugginess. Anyway, I wouldn't worry about it unless it was >=512mb. RAM is cheap, and the stability of a PC is far more important.

----------

## paulb787

same prob  :Sad:     3.8Gb is just not 4GB.. lol

----------

## m4yer

and same here ... 3954mb ...

----------

## schachti

What is your output of

```

dmesg | grep "Memory:"

```

----------

## eccerr0r

"(not me too)"

I'd gladly trade my not-so-stable motherboard for one of yours that have less than 4GB shown:

```
$ free -m

             total       used       free     shared    buffers     cached

Mem:          4044       4001         43          0        228       3557

-/+ buffers/cache:        215       3829

Swap:          964          0        964

$ cat /proc/mtrr

reg00: base=0x100000000 (4096MB), size= 512MB: write-back, count=1

reg01: base=0x120000000 (4608MB), size= 256MB: write-back, count=1

reg02: base=0x00000000 (   0MB), size=2048MB: write-back, count=1

reg03: base=0x80000000 (2048MB), size=1024MB: write-back, count=1

reg04: base=0xc0000000 (3072MB), size= 256MB: write-back, count=1

reg05: base=0xcf800000 (3320MB), size=   8MB: uncachable, count=1

reg06: base=0xcf700000 (3319MB), size=   1MB: uncachable, count=1

```

and this machine has an on-board video card that steals RAM from the memory pool...

The kernel startup message should give some hints where the memory is going.  How much does it start off with?

----------

## selig

I am not completely sure, but IMHO kernel memory is not displayed by "free" and thus it reports less memory available. If you have got a bloated kernel, like on a RHEL x86_64, it eats up e.g. 128 MB (on my 16 GB machine). On my laptop with 768 MB, my hardened x86 Gentoo kernel eats up only about 30 MB. The size varies among systems - I should do a test on one hardware with vastly different kernels, because it may be just BIOS instead of kernel...

----------

## mattst88

This is a problem interpreting the units.

A kilobyte is 1000 bytes. This is the base 10 system.

A kibibyte is 1024 bytes. This is the base 2 system.

I'm guessing you have 4096 MiB of RAM and 64 MiB allocated to graphics. This means you've got 4032 MiB of system memory. 4032 MiB is around 3845 MB of memory. I don't know where the difference of 30 or so MB is, but the fundamental problem is a misunderstanding of the units.

----------

## selig

I do not think this is the case... on my 2GB amd64 system, the difference is 35 MB - on a different amd64 system with 2 GB RAM the difference was 36 MB. I compiled both kernels so they should be approximately the same (I always choose the same options, only some drivers are different, depending on the hardware configuration).

As I mentioned earlier, with RHEL the difference was 128 MB (albeit on a 16 GB machine). I think that this really is the kernel size, because the Red Hat kexec documentation states that you need to allocate min. 128 MB for the kexec kernel.

If it were the difference between 1000 and 1024 kilo/mega/giga bytes, on a 16384 "MB" machine it would mean you get only 15.3 GB - which most certainly is not the case. Anyway, I can look at the reported memory sizes on a lot of different machines running the same kernels when I get back to work on Monday.

----------

## selig

You can check the amount of memory eaten by the kernel by issuing this command:

```

dmesg | grep Memory:

dmesg | grep Freeing

```

(some kernel memory is freed after initialisation but usually it is not much)

----------

## wyvern5

This is almost certainly caused by the BIOS memory hole issue. Much less of an issue on 64bit (32bit windows sees my 4gb as 2.7gb), though. I see 3943 as total mem from free -m. I wouldn't worry about it.

----------

