atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];

The array holds a comprehensive collection of statistical information to describe the status of the memory pages of each CPU; consequently, there is an instance of the structure for each CPU in the system. The individual instances are grouped together in an array to simplify access.

The structure elements are simple, elementary numbers and therefore indicate only how many pages have a specific status. Other means must be devised to find out which pages these are. This issue is discussed below.

The following statistics are collected in vm_stat: <mmzone.h>

enum zone_stat_item {

/* First 128 byte cacheline (assuming 64 bit words) */




NR_ANON_PAGES, /* Mapped anonymous pages */

NR_FILE_MAPPED, /* pagecache pages mapped into pagetables.

only modified from process context */


/* Second 128 byte cacheline */



NR_PAGETABLE, /* used for pagetables */

NR_UNSTABLE_NFS, /* NFS unstable pages */


/* Omitted: NUMA-specific statistics */



The meanings of the entries are easy to guess from their names. nr_file_dirty specifies the number of file-based dirty pages, and nr_writeback indicates how many are currently being written back. nr_pagetable stores the number of pages used to hold the page tables, and nr_file_mapped specifies how many pages are mapped by the page table mechanism (only the file-based pages are accounted for; direct kernel mappings are not included). Finally, nr_slab_reclaimable and nr_slab_unreclaimable indicate how many pages are used for the slab cache described in Chapter 3 (despite their name, the constants work also for the slub cache). The remaining entries consider special cases that are not interesting for our purposes.

Note that the kernel not only keeps a global array to collect page statistics, but also provides the same information resolved by memory zone:

Continue reading here: Info

Was this article helpful?

0 0