Operations 8 min read

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.

Refining Core Development Skills
Refining Core Development Skills
Refining Core Development Skills
Linux Kernel Memory Detection via E820 Mechanism

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.

Memory ManagementOperating SystemsLinux Kernelboot processmemory allocationfirmwareE820
Refining Core Development Skills
Written by

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.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.