CentOS 8 在具有 1GB RAM 的 VPS 上运行。
dmesg 显示:
Memory: 216012K/1048040K available
因此我相信 BIOS 看到的是 1,073,192,960 字节。然后,free -b
读取后发现 RAM 总共有 997,236,736 字节。
这样,我们可以看到差距 75,956,224=1,073,192,960-997,236,736 字节。换句话说,72+MiB 的“不可用”内存。
如何将该内存带回操作系统?或者如何了解它“隐藏”在哪里?
顺便说一句,kdump 已禁用:cat /sys/kernel/kexec_crash_size
0
UPD:
dmesg 中有关内存的开头:
BIOS-provided physical RAM map:
BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
BIOS-e820: [mem 0x0000000000100000-0x000000003ffdbfff] usable
BIOS-e820: [mem 0x000000003ffdc000-0x000000003fffffff] reserved
BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
NX (Execute Disable) protection: active
SMBIOS 2.8 present.
DMI: Red Hat KVM, BIOS 1.11.0-2.el7 04/01/2014
Hypervisor detected: KVM
kvm-clock: Using msrs 4b564d01 and 4b564d00
kvm-clock: cpu 0, msr a001001, primary cpu clock
kvm-clock: using sched offset of 7965121487 cycles
clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 ns
tsc: Detected 2199.996 MHz processor
e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
e820: remove [mem 0x000a0000-0x000fffff] usable
last_pfn = 0x3ffdc max_arch_pfn = 0x400000000
MTRR default type: write-back
MTRR fixed ranges enabled:
00000-9FFFF write-back
A0000-BFFFF uncachable
C0000-FFFFF write-protect
MTRR variable ranges enabled:
0 base 000080000000 mask 3FFF80000000 uncachable
1 disabled
2 disabled
3 disabled
4 disabled
5 disabled
6 disabled
7 disabled
x86/PAT: Configuration [0-7]: WB WC UC- UC WB WP UC- WT
kexec: Reserving the low 1M of memory for crashkernel
Using GB pages for direct mapping
BRK [0x0a201000, 0x0a201fff] PGTABLE
BRK [0x0a202000, 0x0a202fff] PGTABLE
BRK [0x0a203000, 0x0a203fff] PGTABLE
BRK [0x0a204000, 0x0a204fff] PGTABLE
BRK [0x0a205000, 0x0a205fff] PGTABLE
RAMDISK: [mem 0x3506f000-0x3682ffff]
ACPI: Early table checksum verification disabled
ACPI: RSDP 0x00000000000F6280 000014 (v00 BOCHS )
ACPI: RSDT 0x000000003FFE348A 00002C (v01 BOCHS BXPCRSDT 00000001 BXPC 00000001)
ACPI: FACP 0x000000003FFE30EE 000074 (v01 BOCHS BXPCFACP 00000001 BXPC 00000001)
ACPI: DSDT 0x000000003FFE0040 0030AE (v01 BOCHS BXPCDSDT 00000001 BXPC 00000001)
ACPI: FACS 0x000000003FFE0000 000040
ACPI: APIC 0x000000003FFE3162 000328 (v01 BOCHS BXPCAPIC 00000001 BXPC 00000001)
ACPI: Local APIC address 0xfee00000
No NUMA configuration found
Faking a node at [mem 0x0000000000000000-0x000000003ffdbfff]
NODE_DATA(0) allocated [mem 0x3ffb2000-0x3ffdbfff]
crashkernel: memory value expected
Zone ranges:
DMA [mem 0x0000000000001000-0x0000000000ffffff]
DMA32 [mem 0x0000000001000000-0x000000003ffdbfff]
Normal empty
Device empty
Movable zone start for each node
Early memory node ranges
node 0: [mem 0x0000000000001000-0x000000000009efff]
node 0: [mem 0x0000000000100000-0x000000003ffdbfff]
Zeroed struct page in unavailable ranges: 134 pages
Initmem setup node 0 [mem 0x0000000000001000-0x000000003ffdbfff]
On node 0 totalpages: 262010
DMA zone: 64 pages used for memmap
DMA zone: 158 pages reserved
DMA zone: 3998 pages, LIFO batch:0
DMA32 zone: 4032 pages used for memmap
DMA32 zone: 258012 pages, LIFO batch:63
ACPI: PM-Timer IO Port: 0x608
ACPI: Local APIC address 0xfee00000
ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
IOAPIC[0]: apic_id 0, version 17, address 0xfec00000, GSI 0-23
ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
ACPI: IRQ0 used by override.
ACPI: IRQ5 used by override.
ACPI: IRQ9 used by override.
ACPI: IRQ10 used by override.
ACPI: IRQ11 used by override.
Using ACPI (MADT) for SMP configuration information
smpboot: Allowing 87 CPUs, 86 hotplug CPUs
PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
PM: Registered nosave memory: [mem 0x000a0000-0x000effff]
PM: Registered nosave memory: [mem 0x000f0000-0x000fffff]
[mem 0x40000000-0xfeffbfff] available for PCI devices
...
Memory: 216012K/1048040K available (12293K kernel code, 2225K rwdata, 7708K rodata, 2480K init, 14048K bss, 105512K reserved, 0K cma-reserved)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=87, Nodes=1
Kernel/User page tables isolation: enabled
ftrace: allocating 38570 entries in 151 pages
ftrace: allocated 151 pages with 5 groups
答案1
操作系统会保留一些内存以执行低级任务。请尝试dmesg | grep "Memory:
“`”命令来检查保留的内存和其他详细信息。
查看此文档以了解更多信息 -