Linux Kernel Memory Detection via E820 Mechanism
This article explains how the Linux kernel detects physical memory during boot by leveraging the E820 mechanism, where firmware reports memory ranges via interrupt 15H, enabling the kernel to map usable memory addresses for subsequent allocation.
This article details the Linux kernel's memory detection process during boot, focusing on the E820 mechanism. Firmware communicates available memory ranges to the kernel through interrupt 15H with E820 opcode, which the kernel stores in boot_params.e820_table and later transfers to a global e820_table structure.
The kernel then prints memory maps showing usable and reserved regions. Code examples illustrate the detect_memory_e820 function that handles interrupt handling and data parsing. The process ensures the kernel understands physical memory layout before allocating resources via memblock and buddy allocator systems.
Key steps include firmware initialization, E820 interrupt handling, memory mapping storage, and subsequent memory management by kernel subsystems. The article also demonstrates how to inspect these results using dmesg commands.
Refining Core Development Skills
Fei has over 10 years of development experience at Tencent and Sogou. Through this account, he shares his deep insights on performance.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.