Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have 2x2 GiB sticks of RAM installed.
Running memtest86 from the grub boot menu confirms this.. memtest86 reports no errors.

However every which way I check my available memory in a running Ubuntu 10.04 system, it reports only approximately 3.2 GiB.

  • cat /proc/meminfo == 3320132 kB
  • System Monitor == 3.2 GiB
  • htop == 3242 MB
  • free -m == 3242 MB

Who's got my missing RAM ?

Updated info: I just now dual-booted into another version of Ubuntu 10.04 on the same hardware (I forgot I had installed it many months ago, for emergencies) :).... It reports 3.9 GiB, via System Monitor...

I've posted my most recent /var/log/messages information at http://pastebin.ubuntu.com/629246/

share|improve this question
    
What kind of kernel are you using? Unless you use a 'bigmem' or 'x86-64', you may not have all of your RAM visible to the system. Also, some BIOS options affect the visibility of the total RAM. Use your /var/log/messages log (at the very beginning) to see how memory regions were mapped. –  mbaitoff Jun 19 '11 at 7:36
    
I don't know how to interpret /var/log/messages , but I've posted my most recent information here: pastebin.ubuntu.com/629246 .. maybe someone can make heads-or-tails of it :) –  Peter.O Jun 19 '11 at 8:11
    
Was that log from the 3.2Gb-reported system, or from the 3.9Gb-reported one? –  mbaitoff Jun 19 '11 at 9:13
    
Lines 61,62 from your log shows 3.2Gb available. –  mbaitoff Jun 19 '11 at 9:22
    
I have Ubuntu 10.04 with x86-64 (64bit) installed on 4Gb-machine. It reports 3964 Mb ('free -m'), so your second setup detects your RAM amount correctly. Please check what kind of kernel is installed on your 2nd system. –  mbaitoff Jun 19 '11 at 9:41
show 2 more comments

2 Answers

up vote 14 down vote accepted

A 32-bit address space means that you have space for 4GB of addresses. Ideally the kernel likes to be able to map all physical memory, all the memory of the current task, and all of its own memory. If physical memory alone takes up all of the available 4GB, that won't work. So physical memory is divided into low memory, which is mapped all the time, and high memory, which must be mapped when in use. Unless you're running a patched kernel, on the ix86 architecture, 128MB of address space is devoted to kernel code and data structures, and 896MB is devoted to mapping physical memory (for a total of 1GB).

Background reading on the complexities of memory management when your address space isn't comfortably larger than your total memory:

Excerpts from your kernel logs:

BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009f800 (usable)
BIOS-e820: 000000000009f800 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 00000000cdce0000 (usable)
BIOS-e820: 00000000cdce0000 - 00000000cdce3000 (ACPI NVS)
BIOS-e820: 00000000cdce3000 - 00000000cdcf0000 (ACPI data)
BIOS-e820: 00000000cdcf0000 - 00000000cdd00000 (reserved)
BIOS-e820: 00000000d0000000 - 00000000e0000000 (reserved)
BIOS-e820: 00000000fec00000 - 0000000100000000 (reserved)
BIOS-e820: 0000000100000000 - 0000000130000000 (usable)
2404MB HIGHMEM available.
887MB LOWMEM available.
Zone PFN ranges:
DMA      0x00000000 -> 0x00001000
Normal   0x00001000 -> 0x000377fe
HighMem  0x000377fe -> 0x000cdce0

Here you have 887MB of low memory: the theoretical maximum of 896MB minus a few MB of DMA buffers (zones of memory used to communicate with hardware devices).

Of your physical memory, 3328MB is mapped at addresses below 4GB and 768MB is mapped at addresses above 4GB (the 0x100000000–0x130000000 range). You're not getting access to these 768MB, which explains why you only have 3242MB available (4096MB of RAM minus 768MB inaccessible minus 9MB of DMA buffers minus 75MB used by the kernel itself for code and data). I don't know why the BIOS maps some RAM above the 4GB mark, but as a data point, I'm posting this from a PC with 4GB of RAM that similarly has RAM mapped at 0x100000000–0x130000000.

Mapping physical memory above 4GB requires using PAE. PAE incurs a small performance overhead (in particular, it requires bigger data structures in the memory manager), so it's not systematically enabled. The default Ubuntu kernel is compiled without PAE support. Get the -generic-pae kernel Install linux-image-generic-pae to be able to access up to 64GB of RAM.

TL,DR: Linux is working as expected. The firmware isn't so helpful. Get a PAE-enabled kernel.

share|improve this answer
    
Well, that was easy ... Thanks Gilles :) ...understanding the log is definitely harder!... I've installed linux-image-2.6.32-32-generic-pae, and htop now reports 3990 MiB –  Peter.O Jun 19 '11 at 12:22
1  
The machine maps the ram above the 4gb mark so that it can put hardware memory like your video ram under the 4gb mark so that they can be used by non pae enabled 32 bit kernels. –  psusi Jun 20 '11 at 13:50
    
I suppose all your GB should be GiB? –  Techlive Zheng Dec 16 '12 at 7:22
    
@TechliveZheng This is a computer tech site, not a physics site. All my MB, GB, etc. are indeed MiB, GiB, etc. –  Gilles Dec 16 '12 at 21:24
add comment

Maybe it is because the architecture of your Ubuntu is i386 (32 bit version). What is the result when you run uname -a?

share|improve this answer
    
uname -a ... Linux DT9400 2.6.32-32-generic #62-Ubuntu SMP Wed Apr 20 21:54:21 UTC 2011 i686 GNU/Linux ... However, as I metioned in the "Updated info:" in my queston, another 10.04 32bit dual-booted installation shows 3.9 Gib .. Both of the dual-boot systems were installed from the same CD, but are currtnly running differnt kernels, and have different programs installed ... BTW, this is not a recent happening, It has been showing 3.2 GiB for many months.. –  Peter.O Jun 19 '11 at 8:52
    
You're obviously running a 32-bit kernel ('i686'). By the way, 3.9Gb already means 4Gb, since some address space is reserved by the hardware. –  mbaitoff Jun 19 '11 at 9:17
    
Yes, thanks mbaitoff, I would expect a bit of memory to go walkabout, but I think 0.8 GiB is too much, so I'd like to find out what is going on here. –  Peter.O Jun 19 '11 at 9:48
    
AFAIK Ubuntu can install PAE kernel which can use big amounts of RAM even on x86 –  Anton Barkovsky Jun 19 '11 at 11:06
3  
I think you just need to install pae kernel (linux-generic-pae and linux-headers-generic-pae) and, if you like, remove general kernel. –  Anton Barkovsky Jun 19 '11 at 19:36
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.