在 64 位 Debian 上仅检测到 3.2GB 的 4GB RAM

Jon*_*art 9 memory linux debian-squeeze

我正在运行 Debian Squeeze (x64):

# uname -srvmo
Linux 2.6.32-5-amd64 #1 SMP Mon Jan 16 16:22:28 UTC 2012 x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud)

我的G31M-S 主板中有 2 个兼容的 2 GB DDR2 棒。它支持高达 8GB:

在此处输入图片说明

由于这是一个服务器,我并不真正关心图形。所以我把它调到最低。

Internal Graphics Mode Select: Auto
                               Enabled, 1MB   <--
                               Enabled, 8MB
DVMT Mode Select:              Fixed Mode     <--
                               Auto
    DVMT/FIXED Memory:         128MB          <--
                               256MB
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

但是,Linux 仅检测到 3.19GiB 的内存:

# cat /proc/meminfo
MemTotal:        3350712 kB
...
Run Code Online (Sandbox Code Playgroud)

E820图

[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 000000000009f800 (usable)
[    0.000000]  BIOS-e820: 000000000009f800 - 00000000000a0000 (reserved)
[    0.000000]  BIOS-e820: 00000000000e6000 - 0000000000100000 (reserved)
[    0.000000]  BIOS-e820: 0000000000100000 - 00000000cfdb0000 (usable)
[    0.000000]  BIOS-e820: 00000000cfdb0000 - 00000000cfdc0000 (ACPI data)
[    0.000000]  BIOS-e820: 00000000cfdc0000 - 00000000cfdf0000 (ACPI NVS)
[    0.000000]  BIOS-e820: 00000000cfdf0000 - 00000000cfe00000 (reserved)
[    0.000000]  BIOS-e820: 00000000fed00000 - 00000000fed00400 (reserved)
[    0.000000]  BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
[    0.000000]  BIOS-e820: 00000000ff380000 - 0000000100000000 (reserved)
[    0.000000] DMI present.
[    0.000000] AMI BIOS detected: BIOS may corrupt low RAM, working around it.
[    0.000000] e820 update range: 0000000000000000 - 0000000000010000 (usable) ==> (reserved)
Run Code Online (Sandbox Code Playgroud)

并做一些数学运算:

>>> ((0x9F800 - 0x10000) + (0xCF6B0000 - 0x100000)) / 1024.0 / 1024.0 / 1024.0
3.240476608276367
Run Code Online (Sandbox Code Playgroud)

我们得到几乎相同的答案。

我错过了什么?


我并不完全相信“PCI 地址空间”的说法。取出两个 2GB 中的一个,设置屏幕显示 2048MB。

# cat /proc/meminfo
MemTotal:        2058432 kB
Run Code Online (Sandbox Code Playgroud)

那是 1.96GB。

E820贴图

[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 000000000009f800 (usable)
[    0.000000]  BIOS-e820: 000000000009f800 - 00000000000a0000 (reserved)
[    0.000000]  BIOS-e820: 00000000000e6000 - 0000000000100000 (reserved)
[    0.000000]  BIOS-e820: 0000000000100000 - 000000007fdb0000 (usable)
[    0.000000]  BIOS-e820: 000000007fdb0000 - 000000007fdc0000 (ACPI data)
[    0.000000]  BIOS-e820: 000000007fdc0000 - 000000007fdf0000 (ACPI NVS)
[    0.000000]  BIOS-e820: 000000007fdf0000 - 000000007fe00000 (reserved)
[    0.000000]  BIOS-e820: 00000000fed00000 - 00000000fed00400 (reserved)
[    0.000000]  BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
[    0.000000]  BIOS-e820: 00000000ff380000 - 0000000100000000 (reserved)
[    0.000000] DMI present.
[    0.000000] AMI BIOS detected: BIOS may corrupt low RAM, working around it.
[    0.000000] e820 update range: 0000000000000000 - 0000000000010000 (usable) ==> (reserved)
Run Code Online (Sandbox Code Playgroud)

还有数学...

>>> ((0x9F800 - 0x10000) + (0x7fdb0000 - 0x100000)) / 1024.0 / 1024.0 / 1024.0
1.9973125457763672
Run Code Online (Sandbox Code Playgroud)

所以我得到了 2GB / 2GB。 /proc/cpuinfo显示我的处理器支持 36 位物理寻址。2^36 = 64GB,我什至不接近。


# ./smem -R 4G -w
Area                           Used      Cache   Noncache
firmware/hardware            843592          0     843592
kernel image                      0          0          0
kernel dynamic memory        181116     134616      46500
userspace memory             287784      19736     268048
free memory                 2881812    2881812          0
Run Code Online (Sandbox Code Playgroud)

Hen*_*nes 5

PCI 还使用一些地址空间。PCI 卡和 PCI 设备都内置在主板中(例如芯片组)。

通常这意味着 4GB 中只有 3¼ 到 3½ GB 可用,即使您没有使用具有大量板载 RAM 的现代 GPU。


Dav*_*rtz 5

你需要把内存重映射ON在BIOS中。否则,它不会重新映射超过 4GB 边界的内存,并且一些内存将被硬件映射覆盖。