Skip to content

Instantly share code, notes, and snippets.

@mrmichalis
Created July 4, 2013 00:54
Show Gist options
  • Save mrmichalis/5924104 to your computer and use it in GitHub Desktop.
Save mrmichalis/5924104 to your computer and use it in GitHub Desktop.
Here's an updated explanation, 3.9 kernel
[root@destiny ~]# cat /proc/meminfo
MemTotal: 16439720 kB
MemFree: 14309796 kB
Buffers: 67732 kB
Cached: 667072 kB
SwapCached: 0 kB
Active: 527128 kB
Inactive: 263504 kB
Active(anon): 112068 kB
Inactive(anon): 19356 kB
Active(file): 415060 kB
Inactive(file): 244148 kB
Unevictable: 3504 kB
Mlocked: 3504 kB
SwapTotal: 18513916 kB
SwapFree: 18513916 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 59336 kB
Mapped: 14680 kB
Shmem: 73332 kB
Slab: 408128 kB
SReclaimable: 270972 kB
SUnreclaim: 137156 kB
KernelStack: 1440 kB
PageTables: 3240 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 26733776 kB
Committed_AS: 305760 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 395572 kB
VmallocChunk: 34359334264 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 86048 kB
DirectMap2M: 5152768 kB
DirectMap1G: 13631488 kB
Terms
Anonymous pages - Pages that are allocated by applications. So if you do malloc() you are going to get an anonymous page.
Pagecache - Pages that contain data from a disk somewhere.
Values
MemTotal: How much RAM you have plugged into your motherboard.
MemFree: How much of that RAM isn't being used.
Buffers: How much RAM is used by struct buffer_heads. Basically if you use ext* this is how much metadata is being held in ram.
Cached: How much RAM is being used by file data.
SwapCached: Total amount of Swap space that's actually in memory right now.
Active: Active anonymous pages + Active pagecache.
Inactive: Inactive anonymous pages + Inactive pagecache.
Unevictable: These pages aren't going anywhere, they are pinned, cannot be swapped or reclaimed. Includes kernel pages and Mlocked pages.
Mlocked: Just mlocked() pages from userspace.
SwapTotal: Total swap space.
SwapFree: How much swap space is free.
Dirty: Pagecache pages that are dirty, waiting to be written to disk.
Writeback: Pagecache pages that are currently being written to disk but have not been completed yet.
AnonPages: Total number of anonymous pages, will include anonymous hugepages.
Mapped: Number of file backed mmap()'ed pages.
Shmem: Size of shared memory, anybody who did mmap() with MAP_SHARED|MAP_ANONYMOUS
Slab: Size of allocations made by the kernel
SReclaimable: Kernel allocations that are reclaimable, for example XFS has a shrinker for its metadata allocations and so allocations made of that pool are marked as reclaimable
SUnreclaim: Kernel allocations that are unreclaimable
KernelStack: Pages used for kernel stack space
PageTables: The memory needed to keep track of all the pages in the system
NFS_Unstable: Like Writeback but for NFS, since it has no "completion" in the same sort of way device backed pages do. Pages being written and waiting on a COMMIT message from the * NFS server to say that the write has completed. (I could be a little off on the semantics since I'm not an NFS developer but I think it's mostly correct)
Bounce: Bounce buffers. Some file systems will allow you to dirty pages while they are being written, which if you do things like data csumming can fuck you because you need the csum to match what makes it to disk. So if your device requires stable pages it will allocate a page, copy the dirty page into it, and then write the copy to disk to make sure it is stable. That's what this is for.
WritebackTmp: Used for FUSE, it's the same thing as Writeback or NFS_Unstable, just FUSE-ified.
CommitLimit: How much we are allowed to try to allocate. You can malloc() to your hearts content but until you go to write to that area there are no pages backing that address. That is what the commit/overcommit stuff does, allows you to malloc() up to the CommitLimit before malloc() returns -ENOMEM.
Committed_AS: How much is currently committed. Basically all of the malloc()'s added up.
VmallocTotal: How much the kernel can vmalloc() before it complains loudly.
VmallocUsed: How much the kernel has vmalloc()'ed.
VmallocChunk: The largest chunk of vmalloc'able area. Usually just == to VmallocTotal.
HardwareCorrupted: ECC at it's finest.
HugePages*: Accounting for hugepages
Hugepagesize: The size of each hugepage on this system
DirectMap*: This is x86 specific, basically available direct mapped slots. I don't quite understand the direct mapping scheme, but it's more for MM/arch developers than users.
Some things not shown in my meminfo
HighTotal, HighFree, LowTotal, LowFree: If you have a 32bit kernel with a shittone of memory then your memory will be split between low and high sections. Low memory is available for the kernel to use since it can just address it and get to it. High memory is for pagecache and user memory since we are allowed to go through the fault handler to get to that stuff.
Notes
A lot of this is from memory so it may not be quite right, but hopefully it makes it a little clearer.
EDIT: formatting, apparently I'm awful at this. EDIT1: Still trying.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment