20230414--RHEL/Rocky/AlmaLinux8体现内存低于实际硬件内存・其二

程序员 2024-9-27 12:45:12 47 0 来自 中国
前次修改crashkernel设置将可用内存提拔了至少160M,也提到可用内存与硬件内存还存在较大的差距,本文就来简朴分析另有哪些硬件内存被预先分配了。
1.重要的内存数据

1)硬件内存1024M,1048576kB
# dmidecode -t 6|moreHandle 0x0085, DMI type 6, 12 bytesMemory Module Information        Socket Designation: RAM socket #0        Bank Connections: None        Current Speed: Unknown        Type: EDO DIMM        Installed Size: 1024 MB (Single-bank Connection)        Enabled Size: 1024 MB (Single-bank Connection)        Error Status: OK2)可用内存959796 kB,937M
# more /proc/meminfo |grep MemTotalMemTotal:         959796 kB# free -m              total        used        free      shared  buff/cache   availableMem:            937         400          83           9         453         357Swap:          2099         232        18673)预分配内存123852kB,121M
# dmesg |grep -i mem|more[    0.000000] Memory: 261120K/1048052K available (12293K kernel code, 5878K rwdata, 8380K rodata, 2552K init, 14256K bss, 123852K reserved, 0K cma-reserved)2.哪些资源预分配了内存:e820

在操纵体系开始管理内存之前,起首要获取物理内存的信息,好比共有多少物理地点是可用的? 有哪些物理地点是被ACPI(Advanced Configuration and Power Interface)数据使用? 这些信息从何而来?e820就是x86架构(包罗x86_64)上的操纵体系引导步调提供物理内存信息的功能。当哀求BIOS停止号15H,而且置操纵码AX=E820H的时间,BIOS就会向调用者陈诉可用的物理地点区间等信息,e820由此得名。
什么是E820?
E820是基于X86的盘算机体系的BIOS将内存映射陈诉给操纵体系或引导加载步调的便利工具。通过将AX寄存器设置为十六进制值E820,可以通过INT15H调用对其举行访问,陈诉哪些内存地点范围可用,哪些保存给BIOS使用。"BIOS-e820"通常是启动Linux内核陈诉的第一件事,可以通过dmesg命令看到它。
Usable:体现已经被映射到物理内存的物理地点,即可用地点段
Reserved:体现这些区间是没有被映射到任何地方,不能看成RAM来使用,但是Kernel可决定将该区间映射到其他地方,好比PCI装备。通过读取/proc/iomem可以查察物理地点空间的映射环境,可以知道这些reserved的空间,是怎样进一步分配给差别的装备来使用的。
ACPI data:体现映射到用来存放ACPI数据的RAM空间,操纵体系应该将ACPI Table读入到这个区间内。
ACPI NVS:体现映射到用来存放ACPI数据的非易失性存储空间,操纵体系不能使用。
Unusable:体现检测到发生错误的物理内存。
Usable# dmesg |grep -i mem|grep usable[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009ebff] usable[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000003fedffff] usable[    0.000000] BIOS-e820: [mem 0x000000003ff00000-0x000000003fffffff] usable[    0.000000] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved[    0.000000] e820: remove [mem 0x000a0000-0x000fffff] usablereserved# dmesg |grep -i mem|grep reserved[    0.000000] BIOS-e820: [mem 0x000000000009ec00-0x000000000009ffff] reserved[    0.000000] BIOS-e820: [mem 0x00000000000dc000-0x00000000000fffff] reserved[    0.000000] BIOS-e820: [mem 0x00000000f0000000-0x00000000f7ffffff] reserved[    0.000000] BIOS-e820: [mem 0x00000000fec00000-0x00000000fec0ffff] reserved[    0.000000] BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved[    0.000000] BIOS-e820: [mem 0x00000000fffe0000-0x00000000ffffffff] reserved[    0.000000] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved[    0.000000] Memory: 261120K/1048052K available (12293K kernel code, 5878K rwdata, 8380K rodata, 2552K init, 14256K bss, 123852K reserved, 0K cma-reserved)[    0.020659] PCI: MMCONFIG at [mem 0xf0000000-0xf7ffffff] reserved in E820[    0.168259] system 00:04: [mem 0xfed00000-0xfed003ff] has been reserved[    0.169441] system 00:05: [mem 0xf0000000-0xf7ffffff] has been reserved[    0.169442] system 00:05: [mem 0xfe800000-0xfe9fffff] has been reservedACPI data&&ACPI NVS
# dmesg |grep -i mem|grep -i acpi[    0.000000] BIOS-e820: [mem 0x000000003fee0000-0x000000003fefefff] ACPI data[    0.000000] BIOS-e820: [mem 0x000000003feff000-0x000000003fefffff] ACPI NVS[    0.000000] ACPI: SRAT 0x000000003FEE9757 0008A8 (v02 VMWARE MEMPLUG  06040000 VMW  00000001)[    0.000000] ACPI: Reserving FACP table memory at [mem 0x3fefee73-0x3fefef66][    0.000000] ACPI: Reserving DSDT table memory at [mem 0x3feeaa08-0x3fefee72][    0.000000] ACPI: Reserving FACS table memory at [mem 0x3fefffc0-0x3fefffff][    0.000000] ACPI: Reserving FACS table memory at [mem 0x3fefffc0-0x3fefffff][    0.000000] ACPI: Reserving BOOT table memory at [mem 0x3feea9e0-0x3feeaa07][    0.000000] ACPI: Reserving APIC table memory at [mem 0x3feea29e-0x3feea9df][    0.000000] ACPI: Reserving MCFG table memory at [mem 0x3feea262-0x3feea29d][    0.000000] ACPI: Reserving SRAT table memory at [mem 0x3fee9757-0x3fee9ffe][    0.000000] ACPI: Reserving HPET table memory at [mem 0x3fee971f-0x3fee9756][    0.000000] ACPI: Reserving WAET table memory at [mem 0x3fee96f7-0x3fee971e][    0.000000] ACPI: SRAT: Node 0 PXM 0 [mem 0x00000000-0x0009ffff][    0.000000] ACPI: SRAT: Node 0 PXM 0 [mem 0x00100000-0x3fffffff][    0.000000] ACPI: SRAT: Node 0 PXM 0 [mem 0x40000000-0xbfffffff] hotplug[    0.018861] ACPI: PM: Registering ACPI NVS region [mem 0x3feff000-0x3fefffff] (4096 bytes)3.reserved分配环境

Reserved:是Kernel可决定将该区间映射到其他地方,好比PCI装备。通过读取/proc/iomem可以查察物理地点空间的映射环境,可以知道这些reserved的空间,是怎样进一步分配给差别的装备来使用的。
# more /proc/iomem |grep -i Reserved00000000-00000fff : Reserved         #0~4095=40960009ec00-0009ffff : Reserved         #650240~655359=5120000dc000-000fffff : Reserved         #901120~1048575=147456  000f0000-000fffff : System ROM  f0000000-f7ffffff : PCI MMCONFIG 0000 [bus 00-7f]    f0000000-f7ffffff : Reserved     #4026531840~4160749567=134217728      f0000000-f7ffffff : pnp 00:054026531840fec00000-fec0ffff : Reserved         #4273995776~4274061311=65536  fec00000-fec003ff : IOAPIC 0fee00000-fee00fff : Local APIC  fee00000-fee00fff : Reserved       #4276092928~4276097023=4096fffe0000-ffffffff : Reserved         #4294836224~4294967295=131071总计:134,575,104
涉及Kernel分配Reserved,后续再分析,尤其从对比RHEL/Rocky/AlmaLinux8动手。
参考URL

https://www.jianshu.com/p/fd7f374976a6
您需要登录后才可以回帖 登录 | 立即注册

Powered by CangBaoKu v1.0 小黑屋藏宝库It社区( 冀ICP备14008649号 )

GMT+8, 2024-11-23 19:58, Processed in 0.142049 second(s), 32 queries.© 2003-2025 cbk Team.

快速回复 返回顶部 返回列表