512MB (x86) 系统上的 82MB“保留内存”

Cor*_*tin 6 linux memory x86 ram

我在具有 512MB RAM 的旧 x86 系统上重新安装了新的 debian 10(一切正常)。
可用内存为 431MB。(现在没有插入显卡)

我不认为在旧的 3.x 内核上“保留”了那么多内存

$ free -m
              total        used        free      shared  buff/cache   available
Mem:            431          59         311           4          60         355

$ cat /proc/meminfo
MemTotal:         441568 kB
Run Code Online (Sandbox Code Playgroud)

日志中有更多关于内存的内容,不确定什么是相关的。我只是好奇丢失的 RAM 去了哪里。

编辑:整个 dmesg

[    0.000000] Linux version 4.19.0-5-686-pae (debian-kernel@lists.debian.org) (gcc version 8.3.0 (Debian 8.3.0-7)) #1 SMP Debian 4.19.37-3 (2019-05-15)
[    0.000000] x86/fpu: x87 FPU will use FXSAVE
[    0.000000] BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000dc000-0x00000000000dffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000001fffffff] usable
[    0.000000] BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000ffff0000-0x00000000ffffffff] reserved
[    0.000000] Notice: NX (Execute Disable) protection missing in CPU!
[    0.000000] Legacy DMI 2.0 present.
[    0.000000] DMI: Micro-Star Inc. INTEL 440LX/INTEL 440LX, BIOS 0627 07/15/95
[    0.000000] tsc: Fast TSC calibration using PIT
[    0.000000] tsc: Detected 334.067 MHz processor
[    0.003598] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
[    0.003633] e820: remove [mem 0x000a0000-0x000fffff] usable
[    0.003684] last_pfn = 0x20000 max_arch_pfn = 0x1000000
[    0.003731] MTRR default type: uncachable
[    0.003741] MTRR fixed ranges enabled:
[    0.003758]   00000-9FFFF write-back
[    0.003773]   A0000-FFFFF uncachable
[    0.003782] MTRR variable ranges enabled:
[    0.003798]   0 base 000000000 mask FE0000000 write-back
[    0.003807]   1 disabled
[    0.003815]   2 disabled
[    0.003823]   3 disabled
[    0.003831]   4 disabled
[    0.003839]   5 disabled
[    0.003847]   6 disabled
[    0.003855]   7 disabled
[    0.007325] x86/PAT: PAT not supported by CPU.
[    0.007771] x86/PAT: Configuration [0-7]: WB  WT  UC- UC  WB  WT  UC- UC  
[    0.050001] found SMP MP-table at [mem 0x000fb250-0x000fb25f]
[    0.112510] initial memory mapped: [mem 0x00000000-0x1affffff]
[    0.112544] Base memory trampoline at [(ptrval)] 9b000 size 16384
[    0.112573] Kernel/User page tables isolation: disabled on command line.
[    0.113047] BRK [0x1ab82000, 0x1ab83fff] PGTABLE
[    0.113082] BRK [0x1ab84000, 0x1ab84fff] PGTABLE
[    0.113105] BRK [0x1ab85000, 0x1ab85fff] PGTABLE
[    0.113219] RAMDISK: [mem 0x1e40a000-0x1f885fff]
[    0.113277] 0MB HIGHMEM available.
[    0.113291] 512MB LOWMEM available.
[    0.113299]   mapped low ram: 0 - 20000000
[    0.113307]   low ram: 0 - 20000000
[    0.113367] BRK [0x1ab86000, 0x1ab86fff] PGTABLE
[    0.113399] Zone ranges:
[    0.113408]   DMA      [mem 0x0000000000001000-0x0000000000ffffff]
[    0.113425]   Normal   [mem 0x0000000001000000-0x000000001fffffff]
[    0.113440]   HighMem  empty
[    0.113451] Movable zone start for each node
[    0.113457] Early memory node ranges
[    0.113469]   node   0: [mem 0x0000000000001000-0x000000000009efff]
[    0.113480]   node   0: [mem 0x0000000000100000-0x000000001fffffff]
[    0.113496] Initmem setup node 0 [mem 0x0000000000001000-0x000000001fffffff]
[    0.113513] On node 0 totalpages: 130974
[    0.142335]   DMA zone: 40 pages used for memmap
[    0.142352]   DMA zone: 0 pages reserved
[    0.142364]   DMA zone: 3998 pages, LIFO batch:0
[    0.143743]   Normal zone: 1240 pages used for memmap
[    0.143760]   Normal zone: 126976 pages, LIFO batch:31
[    0.185825] Using APIC driver default
[    0.185978] SFI: Simple Firmware Interface v0.81 http://simplefirmware.org
[    0.194121] Intel MultiProcessor Specification v1.1
[    0.194130]     Virtual Wire compatibility mode.
[    0.194215] MPTABLE: OEM ID: MSI     
[    0.194223] MPTABLE: Product ID: 
[    0.194233] MPTABLE: APIC at: 0xFEE00000
[    0.194254] Processor #0 (Bootup-CPU)
[    0.194272] Processor #1
[    0.194367] IOAPIC[0]: apic_id 2, version 17, address 0xfec00000, GSI 0-23
[    0.194468] Processors: 2
[    0.194485] smpboot: Allowing 2 CPUs, 0 hotplug CPUs
[    0.194647] PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
[    0.194669] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
[    0.194679] PM: Registered nosave memory: [mem 0x000a0000-0x000dbfff]
[    0.194688] PM: Registered nosave memory: [mem 0x000dc000-0x000dffff]
[    0.194697] PM: Registered nosave memory: [mem 0x000e0000-0x000effff]
[    0.194706] PM: Registered nosave memory: [mem 0x000f0000-0x000fffff]
[    0.194733] [mem 0x20000000-0xfebfffff] available for PCI devices
[    0.194744] Booting paravirtualized kernel on bare hardware
[    0.194780] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645519600211568 ns
[    0.194914] random: get_random_bytes called from start_kernel+0x81/0x45f with crng_init=0
[    0.194994] setup_percpu: NR_CPUS:32 nr_cpumask_bits:32 nr_cpu_ids:2 nr_node_ids:1
[    0.197559] percpu: Embedded 29 pages/cpu s89932 r0 d28852 u118784
[    0.197634] pcpu-alloc: s89932 r0 d28852 u118784 alloc=29*4096
[    0.197648] pcpu-alloc: [0] 0 [0] 1 
[    0.197835] Built 1 zonelists, mobility grouping on.  Total pages: 129694
[    0.197861] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.19.0-5-686-pae root=UUID=375c43d8-1ed9-48c6-a196-9787ccb61863 ro quiet acpi=off nopti nospectre_v2 nospec_store_bypass_disable
[    0.200664] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.201381] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.201402] BRK [0x1ab87000, 0x1ab87fff] PGTABLE
[    0.201574] Initializing CPU#0
[    0.585340] Initializing HighMem for node 0 (00000000:00000000)
[    0.648160] Memory: 419336K/523896K available (6751K kernel code, 660K rwdata, 2068K rodata, 880K init, 452K bss, 104560K reserved, 0K cma-reserved, 0K highmem)
[    0.648224] virtual kernel memory layout:
                   fixmap  : 0xffd35000 - 0xfffff000   (2856 kB)
                 cpu_entry : 0xff400000 - 0xff8e1000   (4996 kB)
                   pkmap   : 0xff000000 - 0xff200000   (2048 kB)
                   vmalloc : 0xe0800000 - 0xfeffe000   ( 487 MB)
                   lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
                     .init : 0xda955000 - 0xdaa31000   ( 880 kB)
                     .data : 0xda697dd8 - 0xda945300   (2741 kB)
                     .text : 0xda000000 - 0xda697dd8   (6751 kB)
[    0.648233] Checking if this processor honours the WP bit even in supervisor mode...Ok.
[    0.649959] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.649986] ftrace: allocating 29700 entries in 59 pages
[    0.917280] rcu: Hierarchical RCU implementation.
[    0.917307] rcu:     RCU restricting CPUs from NR_CPUS=32 to nr_cpu_ids=2.
[    0.917321] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[    0.971555] NR_IRQS: 2304, nr_irqs: 440, preallocated irqs: 16
[    0.972398] CPU 0 irqstacks, hard=(ptrval) soft=(ptrval)
[    0.973212] Console: colour dummy device 80x25
[    0.973266] console [tty0] enabled
[    0.973397] APIC: Switch to symmetric I/O mode setup
[    0.973423] Enabling APIC mode:  Flat.  Using 1 I/O APICs
[    0.973801] ExtINT not setup in hardware but reported by MP table
[    0.975451] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=0 pin2=0
[    0.993429] clocksource: tsc-early: mask: 0xffffffffffffffff max_cycles: 0x4d0bcc23f1, max_idle_ns: 440795205856 ns
[    0.993549] Calibrating delay loop (skipped), value calculated using timer frequency.. 668.13 BogoMIPS (lpj=1336268)
[    0.993579] pid_max: default: 32768 minimum: 301
[    0.994118] Security Framework initialized
[    0.994137] Yama: disabled by default; enable with sysctl kernel.yama.*
[    0.994428] AppArmor: AppArmor initialized
[    0.994682] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.994726] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.997334] mce: CPU supports 5 MCE banks
[    0.997553] Last level iTLB entries: 4KB 32, 2MB 0, 4MB 2
[    0.997567] Last level dTLB entries: 4KB 64, 2MB 0, 4MB 8, 1GB 0
[    0.997586] Speculative Store Bypass: Vulnerable
[    0.997761] MDS: Vulnerable: Clear CPU buffers attempted, no microcode
[    0.998665] Freeing SMP alternatives memory: 24K
[    1.117524] smpboot: CPU0: Intel Pentium II (Deschutes) (family: 0x6, model: 0x5, stepping: 0x1)
[    1.119725] Performance Events: p6 PMU driver.
[    1.119776] ... version:                0
[    1.119785] ... bit width:              32
[    1.119791] ... generic registers:      2
[    1.119800] ... value mask:             00000000ffffffff
[    1.119808] ... max period:             000000007fffffff
[    1.119814] ... fixed-purpose events:   0
[    1.119821] ... event mask:             0000000000000003
[    1.120534] rcu: Hierarchical SRCU implementation.
[    1.126044] NMI watchdog: Enabled. Permanently consumes one hw-PMU counter.
[    1.126734] smp: Bringing up secondary CPUs ...
[    1.128629] CPU 1 irqstacks, hard=(ptrval) soft=(ptrval)
[    1.128641] x86: Booting SMP configuration:
[    1.128652] .... node  #0, CPUs:      #1
[    0.005020] Initializing CPU#1
[    0.005020] [Firmware Bug]: CPU1: APIC id mismatch. Firmware: 1 APIC: 0
[    1.214072] smp: Brought up 1 node, 2 CPUs
[    1.214072] smpboot: Max logical packages: 2
[    1.214072] smpboot: Total of 2 processors activated (1336.36 BogoMIPS)
[    1.221630] devtmpfs: initialized
[    1.225770] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    1.225808] futex hash table entries: 512 (order: 3, 32768 bytes)
[    1.226504] pinctrl core: initialized pinctrl subsystem
[    1.228901] NET: Registered protocol family 16
[    1.230743] audit: initializing netlink subsys (disabled)
[    1.231149] audit: type=2000 audit(1558406150.256:1): state=initialized audit_enabled=0 res=1
[    1.231162] cpuidle: using governor ladder
[    1.231240] cpuidle: using governor menu
[    1.234422] PCI: Using configuration type 1 for base access
[    1.249805] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    1.250780] ACPI: Interpreter disabled.
[    1.254036] vgaarb: loaded
[    1.254384] EDAC MC: Ver: 3.0.0
[    1.255121] PCI: Probing PCI hardware
[    1.255121] PCI: root bus 00: using default resources
[    1.255121] PCI: Probing PCI hardware (bus 00)
[    1.255121] PCI host bridge to bus 0000:00
[    1.255121] pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
[    1.255121] pci_bus 0000:00: root bus resource [mem 0x00000000-0xfffffffff]
[    1.255121] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    1.255121] pci 0000:00:00.0: [8086:7180] type 00 class 0x060000
[    1.255121] pci 0000:00:00.0: reg 0x10: [mem 0xe8000000-0xebffffff pref]
[    1.257972] pci 0000:00:01.0: [8086:7181] type 01 class 0x060400
[    1.258520] pci 0000:00:07.0: [8086:7110] type 00 class 0x060100
[    1.259061] pci 0000:00:07.1: [8086:7111] type 00 class 0x010180
[    1.259161] pci 0000:00:07.1: reg 0x20: [io  0xffa0-0xffaf]
[    1.259210] pci 0000:00:07.1: legacy IDE quirk: reg 0x10: [io  0x01f0-0x01f7]
[    1.259226] pci 0000:00:07.1: legacy IDE quirk: reg 0x14: [io  0x03f6]
[    1.259242] pci 0000:00:07.1: legacy IDE quirk: reg 0x18: [io  0x0170-0x0177]
[    1.259256] pci 0000:00:07.1: legacy IDE quirk: reg 0x1c: [io  0x0376]
[    1.259693] pci 0000:00:07.2: [8086:7112] type 00 class 0x0c0300
[    1.259814] pci 0000:00:07.2: reg 0x20: [io  0xda00-0xda1f]
[    1.260284] pci 0000:00:07.3: [8086:7113] type 00 class 0x068000
[    1.260308] * Found PM-Timer Bug on the chipset. Due to workarounds for a bug,
               * this clock source is slow. Consider trying other clock sources
[    1.260473] pci 0000:00:07.3: quirk: [io  0x6100-0x613f] claimed by PIIX4 ACPI
[    1.260497] pci 0000:00:07.3: quirk: [io  0x5f00-0x5f0f] claimed by PIIX4 SMB
[    1.260979] pci 0000:00:0f.0: [13c1:1001] type 00 class 0x010400
[    1.261046] pci 0000:00:0f.0: reg 0x10: [io  0xde00-0xde0f]
[    1.261083] pci 0000:00:0f.0: reg 0x14: [mem 0xeffffff0-0xefffffff]
[    1.261118] pci 0000:00:0f.0: reg 0x18: [mem 0xef000000-0xef7fffff]
[    1.261193] pci 0000:00:0f.0: reg 0x30: [mem 0xeffe0000-0xeffeffff pref]
[    1.261282] pci 0000:00:0f.0: supports D1
[    1.261832] pci 0000:00:12.0: [8086:1026] type 00 class 0x020000
[    1.261917] pci 0000:00:12.0: reg 0x10: [mem 0xeffc0000-0xeffdffff 64bit]
[    1.261962] pci 0000:00:12.0: reg 0x18: [mem 0xeff80000-0xeffbffff 64bit]
[    1.261996] pci 0000:00:12.0: reg 0x20: [io  0xdc00-0xdc3f]
[    1.262046] pci 0000:00:12.0: reg 0x30: [mem 0xeff40000-0xeff7ffff pref]
[    1.262150] pci 0000:00:12.0: PME# supported from D0 D3hot D3cold
[    1.262701] pci_bus 0000:01: extended config space not accessible
[    1.263002] pci 0000:00:01.0: PCI bridge to [bus 01]
[    1.263028] pci 0000:00:01.0:   bridge window [io  0xc000-0xcfff]
[    1.263050] pci 0000:00:01.0:   bridge window [mem 0xeed00000-0xeedfffff]
[    1.263071] pci 0000:00:01.0:   bridge window [mem 0xe6b00000-0xe6bfffff pref]
[    1.263118] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 01
[    1.263753] pci 0000:00:07.0: PIIX/ICH IRQ router [8086:7110]
[    1.263797] PCI: pci_cache_line_size set to 32 bytes
[    1.263899] e820: reserve RAM buffer [mem 0x0009fc00-0x0009ffff]
[    1.266414] clocksource: Switched to clocksource tsc-early
[    1.447210] VFS: Disk quotas dquot_6.6.0
[    1.447437] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    1.449141] AppArmor: AppArmor Filesystem Enabled
[    1.449344] pnp: PnP ACPI: disabled
[    1.449366] PnPBIOS: Scanning system for PnP BIOS support...
[    1.449800] PnPBIOS: Found PnP BIOS installation structure at 0x(ptrval)
[    1.449823] PnPBIOS: PnP BIOS version 1.0, entry 0xf0000:0x6dae, dseg 0xf0000
[    1.450617] pnp 00:00: [mem 0x00000000-0x0009fbff]
[    1.450638] pnp 00:00: [mem 0x0009fc00-0x0009ffff]
[    1.450655] pnp 00:00: [mem 0x000dc000-0x000dffff]
[    1.450670] pnp 00:00: [mem 0x000f0000-0x000fffff]
[    1.450687] pnp 00:00: [mem 0x00100000-0x1fffffff]
[    1.450705] pnp 00:00: [mem 0xfffffffffec00000-0xfffffffffec00fff]
[    1.450723] pnp 00:00: [mem 0xfffffffffee00000-0xfffffffffee00fff]
[    1.450741] pnp 00:00: [mem 0xffffffffffff0000-0xffffffffffffffff]
[    1.451159] system 00:00: [mem 0x00000000-0x0009fbff] could not be reserved
[    1.451184] system 00:00: [mem 0x0009fc00-0x0009ffff] could not be reserved
[    1.451206] system 00:00: [mem 0x000dc000-0x000dffff] could not be reserved
[    1.451227] system 00:00: [mem 0x000f0000-0x000fffff] could not be reserved
[    1.451247] system 00:00: [mem 0x00100000-0x1fffffff] could not be reserved
[    1.451269] system 00:00: [mem 0xfffffffffec00000-0xfffffffffec00fff] could not be reserved
[    1.451291] system 00:00: [mem 0xfffffffffee00000-0xfffffffffee00fff] could not be reserved
[    1.451313] system 00:00: [mem 0xffffffffffff0000-0xffffffffffffffff] could not be reserved
[    1.451377] system 00:00: Plug and Play BIOS device, IDs PNP0c01 (active)
[    1.451513] pnp 00:01: [io  0x0020-0x0021]
[    1.451531] pnp 00:01: [io  0x00a0-0x00a1]
[    1.451551] pnp 00:01: [irq 2]
[    1.451749] pnp 00:01: Plug and Play BIOS device, IDs PNP0000 (active)
[    1.451906] pnp 00:02: [dma 4]
[    1.451924] pnp 00:02: [io  0x0000-0x000f]
[    1.451941] pnp 00:02: [io  0x0080-0x0090]
[    1.451957] pnp 00:02: [io  0x0094-0x009f]
[    1.451974] pnp 00:02: [io  0x00c0-0x00de]
[    1.452200] pnp 00:02: Plug and Play BIOS device, IDs PNP0200 (active)
[    1.452437] pnp 00:03: [irq 0]
[    1.452457] pnp 00:03: [io  0x0040-0x0043]
[    1.452662] pnp 00:03: Plug and Play BIOS device, IDs PNP0100 (active)
[    1.452853] pnp 00:04: [irq 8]
[    1.452872] pnp 00:04: [io  0x0070-0x0071]
[    1.453068] pnp 00:04: Plug and Play BIOS device, IDs PNP0b00 (active)
[    1.453277] pnp 00:05: [irq 1]
[    1.453296] pnp 00:05: [io  0x0060]
[    1.453312] pnp 00:05: [io  0x0064]
[    1.453534] pnp 00:05: Plug and Play BIOS device, IDs PNP0303 (active)
[    1.453761] pnp 00:06: [io  0x0061]
[    1.453964] pnp 00:06: Plug and Play BIOS device, IDs PNP0800 (active)
[    1.454248] pnp 00:07: [irq 13]
[    1.454268] pnp 00:07: [io  0x00f0-0x00ff]
[    1.454468] pnp 00:07: Plug and Play BIOS device, IDs PNP0c04 (active)
[    1.454798] pnp 00:08: [io  0x6100-0x613f]
[    1.454816] pnp 00:08: [io  0x5f00-0x5f0f]
[    1.454833] pnp 00:08: [io  0x04d0-0x04d1]
[    1.454849] pnp 00:08: [io  0x0cf8-0x0cff]
[    1.454866] pnp 00:08: [io  0x0294-0x0297]
[    1.455088] pnp 00:08: Plug and Play BIOS device, IDs PNP0a03 (active)
[    1.455104] PnPBIOS: 9 nodes reported by PnP BIOS; 9 recorded by driver
[    1.483560] pci 0000:00:01.0: PCI bridge to [bus 01]
[    1.483590] pci 0000:00:01.0:   bridge window [io  0xc000-0xcfff]
[    1.483619] pci 0000:00:01.0:   bridge window [mem 0xeed00000-0xeedfffff]
[    1.483642] pci 0000:00:01.0:   bridge window [mem 0xe6b00000-0xe6bfffff pref]
[    1.483684] pci_bus 0000:00: resource 4 [io  0x0000-0xffff]
[    1.483701] pci_bus 0000:00: resource 5 [mem 0x00000000-0xfffffffff]
[    1.483719] pci_bus 0000:01: resource 0 [io  0xc000-0xcfff]
[    1.483735] pci_bus 0000:01: resource 1 [mem 0xeed00000-0xeedfffff]
[    1.483752] pci_bus 0000:01: resource 2 [mem 0xe6b00000-0xe6bfffff pref]
[    1.484194] NET: Registered protocol family 2
[    1.486277] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes)
[    1.486370] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[    1.486499] TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
[    1.486722] TCP: Hash tables configured (established 4096 bind 4096)
[    1.487123] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    1.487199] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    1.487734] NET: Registered protocol family 1
[    1.487803] NET: Registered protocol family 44
[    1.487854] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
[    1.488032] pci 0000:00:07.2: PCI->APIC IRQ transform: INT D -> IRQ 19
[    1.488142] PCI: CLS 32 bytes, default 32
[    1.488902] Unpacking initramfs...
[    6.074902] Freeing initrd memory: 20976K
[    6.074945] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[    6.074962] software IO TLB: mapped [mem 0x16000000-0x1a000000] (64MB)
[    6.082796] Initialise system trusted keyrings
[    6.082913] Key type blacklist registered
[    6.083606] workingset: timestamp_bits=14 max_order=17 bucket_order=3
[    6.105277] zbud: loaded
[    6.106749] pstore: using deflate compression
[    7.084935] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x4d0bcc23f1, max_idle_ns: 440795205856 ns
[    7.085417] clocksource: Switched to clocksource tsc
[   13.550142] Key type asymmetric registered
[   13.550166] Asymmetric key parser 'x509' registered
[   13.550341] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[   13.550843] io scheduler noop registered
[   13.550856] io scheduler deadline registered
[   13.551678] io scheduler cfq registered (default)
[   13.551693] io scheduler mq-deadline registered
[   13.553675] shpchp: Standard Hot Plug PCI Controller Driver version: 0.4
[   13.553857] intel_idle: does not run on family 6 model 5
[   13.554345] isapnp: Scanning for PnP cards...
[   13.909492] isapnp: No Plug & Play device found
[   13.910403] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[   13.916097] Linux agpgart interface v0.103
[   13.917233] agpgart-intel 0000:00:00.0: I

sou*_*edi 7

正在您的系统上启用 SWIOTLB。默认情况下,这会保留 64M RAM。只有当你有超过 4G 的 RAM 并且不能使用硬件 IOMMU,或者你在没有嵌套页表的 Xen 虚拟化下运行时才需要它。恭喜。您在内核中发现了一个错误:-)。

以下任一启动选项都应该可以正常工作:

  • iommu=off - 禁用 SWIOTLB。
  • swiotlb=1 - 将 SWIOTLB 减少到一个“slab”= 128K。

或者您可以尝试修补内核源代码。请参阅下面的补丁,以及它修复的错误的解释:-)。

问题分析

[    0.000000] BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000dc000-0x00000000000dffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000001fffffff] usable
Run Code Online (Sandbox Code Playgroud)

您的物理 RAM 映射为 0-512M。我们从正常的遗留废话开始,但这只会影响 1M ( 0x100000)以下的区域。

[    0.113219] RAMDISK: [mem 0x1e40a000-0x1f885fff]
Run Code Online (Sandbox Code Playgroud)

初始ramdisk占用20M左右。

[ 0.648160] Memory: 419336K/523896K available (6751K kernel code, 660K rwdata, 2068K rodata, 880K init, 452K bss, 104560K reserved, 0K cma-reserved, 0K highmem)

但是现在我们保留了104M。我认为这包括后来释放的 initrd。

[    6.074902] Freeing initrd memory: 20976K
Run Code Online (Sandbox Code Playgroud)

我认为大部分损失都在这里:

[    6.074945] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[    6.074962] software IO TLB: mapped [mem 0x16000000-0x1a000000] (64MB)
Run Code Online (Sandbox Code Playgroud)

64M 是为反弹缓冲区分配的默认大小

swiotlb 是一种反弹缓冲机制,用于无法访问系统所有内存的 [DMA] 设备。


swiotlb 代码只是在引导过程的早期分配了一大块低内存;然后根据 DMA 分配请求分发该内存。在许多情况下,使用 swiotlb 内存涉及创建“反弹缓冲区”,其中数据在驱动程序的缓冲区和设备可访问的 swiotlb 空间之间复制。用于 swiotlb 的内存已从正常的 Linux 内存管理机制中删除,因此除 DMA 缓冲区外,无法用于任何其他用途。由于这些原因,swiotlb 充其量被视为不优雅。

DMA 问题,第 2 部分,LWN.net,2004 年。

这个解释的奇怪之处在于它说 swiotlb 是英特尔最初实现x86-64 的一种解决方法。看起来您已经与 x86-32 Linux 当前破旧的状态发生了冲突。当 Linux “统一”很多 x86-32 和 x86-64 代码时,也许是一个疏忽?

SWIOTLB初始化代码意味着它不应该在系统上启用了4GB或更少...但我认为这是打破:-D。

/* 4GB broken PCI/AGP hardware bus master zone */
#define MAX_DMA32_PFN ((4UL * 1024 * 1024 * 1024) >> PAGE_SHIFT)

...

 * If 4GB or more detected (and iommu=off not set) or if SME is active
 * then set swiotlb to 1 and return 1.
 */
int __init pci_swiotlb_detect_4gb(void)
{
    /* don't initialize swiotlb if iommu=off (no_iommu=1) */
    if (!no_iommu && max_possible_pfn > MAX_DMA32_PFN)
        swiotlb = 1;
Run Code Online (Sandbox Code Playgroud)

在为 32 位构建时,问题4UL * 1024 * 1024 * 1024评估为0:-D。

修复应该是这样的

arch/x86/include/asm/dma.h:
-#define MAX_DMA32_PFN ((4UL * 1024 * 1024 * 1024) >> PAGE_SHIFT)
+#define MAX_DMA32_PFN (4UL * ((1024 * 1024 * 1024) >> PAGE_SHIFT)))
Run Code Online (Sandbox Code Playgroud)

我在 GPL2 下发布了这个内核补丁(也进入了公共领域)。我没有计划测试或提交它。用这些知识做你想做的事。

  • FTR:该修复程序现在是 Linux 内核 v5.7 的一部分。:-) https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=88743470668ef5eb6b7ba9e0f99888e5999bf172 (2认同)