You are not logged in.

#1 2013-05-26 15:04:36

Raptorista
Member
From: Italy
Registered: 2011-08-01
Posts: 42

Reducing reserved RAM

Hi everybody,
  ever since I can remember, I have always had my 64 bit Archlinux showing me less RAM than I actually have installed [4GB]. In code,

dmidecode | grep Size | grep MB
        Size: 2048 MB
        Size: 2048 MB

but

free -m
             total       used       free     shared    buffers     cached
Mem:          3522       2401       1120          0         85       1002
-/+ buffers/cache:       1313       2208
Swap:            0          0  

and

cat /proc/meminfo | grep MemTotal
         MemTotal:        3606720 kB

After some research, I found out that some of my RAM is marked as "reserved" by the BIOS, in fact

dmesg | grep BIOS | grep reserved
[    0.000000] BIOS-e820: [mem 0x000000000009d800-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000020000000-0x00000000201fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000040004000-0x0000000040004fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000a52e8000-0x00000000baeedfff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000bafff000-0x00000000bf9fffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000f8000000-0x00000000fbffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fed08000-0x00000000fed08fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fed10000-0x00000000fed19fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed1ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000ff980000-0x00000000ffffffff] reserved

and, doing the math with python, those memory intervals add up to approximately the 500 missing MB.

I also have Archlinux installed on another computer with 4GB of RAM and on that computer I can see quite all the RAM [3.9 GiB or something similar].

So, here's the question: Why does the system reserve that memory? How do I free it?

One of the differences between this machine and the other one is that on the latter I have a dedicated ATI graphics card, whereas on this one I have an integrated Intel Graphics HD 4000. Could this be the reason for the memory missing?

Offline

#2 2013-05-26 15:56:07

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: Reducing reserved RAM

Raptorista wrote:

So, here's the question: Why does the system reserve that memory? How do I free it?

One of the differences between this machine and the other one is that on the latter I have a dedicated ATI graphics card, whereas on this one I have an integrated Intel Graphics HD 4000. Could this be the reason for the memory missing?

Yes. Usually you can adjust the amount of reserved RAM somewhere in BIOS/UEFI (but don't expect it to go down to 0).

Offline

#3 2013-05-26 16:03:51

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Reducing reserved RAM

The integrated HD4000 has to get its "shared memory" from somewhere, right?  Where else is it going to come from.  On your dedicated ATI, it provides its own memory, so it does not need to allocate the RAM from the main system.  There is no way yo free this RAM up. It is required for the normal operation of your system.  Are you in a situation where youare using all the RAM and it is swapping to disk?  If that is the case, do you really think that you know better than your system in how it should allocate its memory, paritcularly for something as vital as the bios/firmware?  If you are running out or RAM (which the "free" output does not indicate), then you need to install more RAM.  But this behavior is to be expected.  The other alternative is to install a dedicated GPU, though with that can come a whole other world of problems that are beyond the scope of this question.

Offline

#4 2013-05-26 16:12:00

Raptorista
Member
From: Italy
Registered: 2011-08-01
Posts: 42

Re: Reducing reserved RAM

@Raynman: I looked it over but found nothing similar to what you mentioned.

@WW: yes, that's what I thought, thanks for confirmation.
I am not running out of RAM on my daily use but, doing scientific computing, sometimes RAM is never enough smile
Moreover, I was curious to know what was the cause of this issue.

As a side effect, this also answers the question "what's my graphics card's memory?" which I've had for long!

Thanks for helping.

Offline

#5 2013-05-26 16:26:26

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: Reducing reserved RAM

The e820 memory map is provided by BIOS. Generally, "reserved" means that for some reasons BIOS doesn't want OS to touch this part of memory, probably because it's used by BIOS or ACPI. Linux doesn't use such memory to prevent Linux and BIOS from overwriting each other's data.

However, 512MB is a bit too much for BIOS data. And probably it isn't GPU either, because 350MB + 2×64MB doesn't really make much sense for GPU and AFAIK Intel BIOSes (as opposed to AMD ones) hide only about 8MB of RAM for exclusive use by the GPU (grep dmesg for "stolen memory") and Intel GPU drivers allocate buffers of OS managed memory when they need more.

You can try lowering "GPU memory" in BIOS setup, but this probably won't work, as explained above. If your e820 doesn't indicate any "usable" memory above 0x1.0000.0000, you may have "memory hole remapping" disabled in BIOS, but I really doubt that this is the case and I expect your system to have few hundred MB of "usable" above 0x1.0000.0000.

This brings us to the wonderful world of BIOS bugs smile Start with disabling UEFI mode, if you have this. Complain to your motherboard vendor. Check if there are BIOS updates for your system.

Last edited by mich41 (2013-05-26 16:28:05)

Offline

#6 2013-05-26 16:42:49

Raptorista
Member
From: Italy
Registered: 2011-08-01
Posts: 42

Re: Reducing reserved RAM

@mich41: you made an educated guess. which brings us back to trouble!
I never enabled UEFI, so that is not the problem.
There doesn't seem to be any bios update [I'm using a Dell XPS13 L322X, bought just some months ago]. My motherboard vendor would be Intel, I guess... I'll try searching in that direction.
Thanks for your help smile

Offline

#7 2013-05-26 18:38:36

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Reducing reserved RAM

The HD4000 can use up to 768MB of shared RAM.  But it is allotted as needed I am pretty sure.  Though I think that it starts out with a certain base level, so there is automatically a certain amount that is reported as not available (which is what mich41 has already stated above).  The amount of RAM that the HD4000 I think is considerably more than that of the HD3000, though the performance is also greatly improved as well.

FWIW, I have 8GB of RAM in my machine (Intel i5 3210M w/ HD4000) and this is my output of "free -m":

 free -m
             total       used       free     shared    buffers     cached
Mem:          7832       1687       6145          0          1       1168
-/+ buffers/cache:        517       7315
Swap:            0          0          0

So what you are seeing I think is pretty normal.  Here is my total:

%  cat /proc/meminfo | grep MemTotal
MemTotal:        8020952 kB

If you doo a "free -k" or just a "free", does the "total" value then match the value from /proc/meminfo?

Offline

#8 2013-05-26 19:11:54

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: Reducing reserved RAM

Well, maybe something has changed with new Intel GPUs. Memory map of my older Intel laptop clearly shows over 2038MB out of 2048MB of "usable" memory:

[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009f7ff] usable   # 638kB
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000007f67ffff] usable   # 2037.5 MB

There is only one big reservation at 0x7f680000-0x7fffffff (9.5MB). 8MB of this is likely used by GPU and the rest by firmware and ACPI.

Anyway, if this RAM is indeed eaten by GPU, you should be able to set a limit in BIOS setup.

Last edited by mich41 (2013-05-26 19:18:16)

Offline

#9 2013-05-26 19:16:08

Raptorista
Member
From: Italy
Registered: 2011-08-01
Posts: 42

Re: Reducing reserved RAM

Yes, the value matches in that case. Does this mean that the difference is the amount used by the HD4000?
Anyway, the value is 3606720 kB, still pretty far from the expected 4 GB, which means the "reserved" memory cells are used for something else...

Earlier, I tried to boot my pc from a linux mint live CD, and even then I could only see the 3.6 GB instead of 4.

Offline

#10 2013-05-26 19:21:26

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Reducing reserved RAM

I use UEFI, so I tried to do "dmesg | grep usable", which gave me quite a bit of stuff about reserved space for the bios and whatnot, and also showed some of the memory being given back to the system.  But what really shocked me, and indicates that my assumptions about the HD4000 were way off (in the good direction) is this line:

[    1.190729] [drm] Memory usable by graphics device = 2048M

That is pretty cool, I think.  It is far more than the 768MB I had read elsewhere.  I tend to believe my bios over random spec charts on hardware reviews though...

Offline

#11 2013-05-26 20:02:53

mich41
Member
Registered: 2012-06-22
Posts: 796

Re: Reducing reserved RAM

2048MB is how much memory can be mapped into GPU address space at a time, while this 768MB figure could be the upper limit of memory these GPUs can "steal" from system RAM (i.e. hide from the OS). The actual amount of "stolen memory" is printed somewhere in dmesg; it seems to be 256MB in your case but I still don't understand why would these GPUs ever need that much stolen memory while they are capable of keeping almost all data in OS managed RAM.

Offline

Board footer

Powered by FluxBB