Linux Memory Terminology – Meaning of HardwareCorrupted, DirectMap4k, DirectMap2M in /proc/meminfo

linuxmemoryterminology

I am looking for description of following terms:

  • HardwareCorrupted, DirectMap4k, DirectMap2M fields in "/proc/meminfo" file of Linux.

I could find the following description for the fields from "Free", "buffer", "swap", "dirty" /proc/meminfo Explained:

HardwareCorrupted: ECC at it's finest

DirectMap* : This is x86 specific, basically available direct mapped slots.

but this description is not enough. Can anyone please let me know descriptions for "HardwareCorrupted", "DirectMap4k", "DirectMap2M"?

Best Answer

HardwareCorrupted show the amount of memory in "poisoned pages", i.e. memory which has failed (as flagged by ECC typically). ECC stands for "Error Correcting Code". ECC memory is capable of correcting small errors and detecting larger ones; on typical PCs with non-ECC memory, memory errors go undetected. If an uncorrectable error is detected using ECC (in memory or cache, depending on the system's hardware support), then the Linux kernel marks the corresponding page as poisoned.

DirectMap is shown on x86, Book3s PowerPC, and S/390, and gives an indication of the TLB load, not memory use: it counts the number of pages mapped using the various supported page sizes on each platform (corresponding to different page table levels): 4KiB, 64KiB, 1MiB, 2MiB, 4MiB, 1GiB, or 2GiB pages. The TLB, or "Translation Lookaside Buffer", is a cache used to store mappings between virtual addresses (as seen by software running on your computer) and physical pages in memory (as seen by the hardware); the calculations and memory fetches involved to go from virtual to physical addresses are expensive, so caches are used to avoid needing them too often. But the TLB is small, so accessing a variety of different addresses (too many to stay in the cache) incurs a performance penalty. This penalty can be reduced by using larger pages; on the x86 architecture the traditional page size is 4KiB, but larger pages can be used when possible, and their sizes can be 2MiB, 4MiB or 1GiB.

For more detail you can look up the Wikipedia links I've included, and follow the references from there.