Why does my system show only 3.2 GiB of RAM when I definitely have 4.0 GiB

10,397

Solution 1

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.

Solution 2

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

Share:
10,397

Related videos on Youtube

Peter.O
Author by

Peter.O

Updated on September 18, 2022

Comments

  • Peter.O
    Peter.O over 1 year

    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/

    • mbaitoff
      mbaitoff almost 13 years
      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.
    • Peter.O
      Peter.O almost 13 years
      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 :)
    • mbaitoff
      mbaitoff almost 13 years
      Was that log from the 3.2Gb-reported system, or from the 3.9Gb-reported one?
    • mbaitoff
      mbaitoff almost 13 years
      Lines 61,62 from your log shows 3.2Gb available.
    • mbaitoff
      mbaitoff almost 13 years
      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.
    • Peter.O
      Peter.O almost 13 years
      My main system_1 reports 3.2 GiB RAM uses kennel 2.6.32-32-generic... It reports the same 3.2 GiB for kernels 2.6.32-30-generic and 2.6.32-24-generic.. Howerver, System_2 which reports 3.9 GiB RAM uses kennel 2.6.32-30-generic-pae ... Maybe the -pae is significant?
    • mbaitoff
      mbaitoff almost 13 years
      Yes, '-pae' is the key: 'Physical Address Extension'
  • Peter.O
    Peter.O almost 13 years
    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..
  • mbaitoff
    mbaitoff almost 13 years
    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.
  • Peter.O
    Peter.O almost 13 years
    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.
  • Anton Barkovsky
    Anton Barkovsky almost 13 years
    AFAIK Ubuntu can install PAE kernel which can use big amounts of RAM even on x86
  • Peter.O
    Peter.O almost 13 years
    Installing pae may well be the issue... If that can be made into a how-to install/enable pae to an existing system answer, I'll try it out
  • Peter.O
    Peter.O almost 13 years
    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
  • Anton Barkovsky
    Anton Barkovsky almost 13 years
    I think you just need to install pae kernel (linux-generic-pae and linux-headers-generic-pae) and, if you like, remove general kernel.
  • psusi
    psusi almost 13 years
    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.
  • weynhamz
    weynhamz over 11 years
    I suppose all your GB should be GiB?
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' over 11 years
    @TechliveZheng This is a computer tech site, not a physics site. All my MB, GB, etc. are indeed MiB, GiB, etc.