include/linux/vmstat.h
Source file repositories/reference/linux-study-clean/include/linux/vmstat.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/vmstat.h- Extension
.h- Size
- 15483 bytes
- Lines
- 568
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/percpu.hlinux/mmzone.hlinux/vm_event_item.hlinux/atomic.hlinux/static_key.hlinux/mmdebug.h
Detected Declarations
struct reclaim_statstruct vm_event_stateenum vm_stat_itemfunction __count_vm_eventfunction count_vm_eventfunction __count_vm_eventsfunction count_vm_eventsfunction count_vm_eventfunction zone_numa_event_addfunction zone_numa_event_statefunction global_numa_event_statefunction zone_page_state_addfunction node_page_state_addfunction global_zone_page_statefunction global_node_page_state_pagesfunction global_node_page_statefunction zone_page_statefunction zone_page_state_snapshotfunction __count_numa_eventfunction __count_numa_eventsfunction fold_vm_numa_eventsfunction __mod_zone_page_statefunction __mod_node_page_statefunction __inc_zone_statefunction __inc_node_statefunction __dec_zone_statefunction __dec_node_statefunction __inc_zone_page_statefunction __inc_node_page_statefunction __dec_zone_page_statefunction __dec_node_page_statefunction refresh_zone_stat_thresholdsfunction __zone_stat_add_foliofunction __zone_stat_sub_foliofunction zone_stat_mod_foliofunction zone_stat_add_foliofunction zone_stat_sub_foliofunction __node_stat_mod_foliofunction __node_stat_add_foliofunction __node_stat_sub_foliofunction node_stat_mod_foliofunction node_stat_add_foliofunction node_stat_sub_foliofunction mod_lruvec_page_statefunction mod_lruvec_statefunction lruvec_stat_mod_foliofunction mod_lruvec_page_statefunction lruvec_stat_add_folio
Annotated Snippet
struct reclaim_stat {
unsigned nr_dirty;
unsigned nr_unqueued_dirty;
unsigned nr_congested;
unsigned nr_writeback;
unsigned nr_immediate;
unsigned nr_pageout;
unsigned nr_activate[ANON_AND_FILE];
unsigned nr_ref_keep;
unsigned nr_unmap_fail;
unsigned nr_lazyfree_fail;
unsigned nr_demoted;
};
/* Stat data for system wide items */
enum vm_stat_item {
NR_DIRTY_THRESHOLD,
NR_DIRTY_BG_THRESHOLD,
NR_MEMMAP_PAGES, /* page metadata allocated through buddy allocator */
NR_MEMMAP_BOOT_PAGES, /* page metadata allocated through boot allocator */
NR_VM_STAT_ITEMS,
};
#ifdef CONFIG_VM_EVENT_COUNTERS
/*
* Light weight per cpu counter implementation.
*
* Counters should only be incremented and no critical kernel component
* should rely on the counter values.
*
* Counters are handled completely inline. On many platforms the code
* generated will simply be the increment of a global address.
*/
struct vm_event_state {
unsigned long event[NR_VM_EVENT_ITEMS];
};
DECLARE_PER_CPU(struct vm_event_state, vm_event_states);
/*
* vm counters are allowed to be racy. Use raw_cpu_ops to avoid the
* local_irq_disable overhead.
*/
static inline void __count_vm_event(enum vm_event_item item)
{
raw_cpu_inc(vm_event_states.event[item]);
}
static inline void count_vm_event(enum vm_event_item item)
{
this_cpu_inc(vm_event_states.event[item]);
}
static inline void __count_vm_events(enum vm_event_item item, long delta)
{
raw_cpu_add(vm_event_states.event[item], delta);
}
static inline void count_vm_events(enum vm_event_item item, long delta)
{
this_cpu_add(vm_event_states.event[item], delta);
}
extern void all_vm_events(unsigned long *);
extern void vm_events_fold_cpu(int cpu);
#else
/* Disable counters */
static inline void count_vm_event(enum vm_event_item item)
{
}
static inline void count_vm_events(enum vm_event_item item, long delta)
{
}
static inline void __count_vm_event(enum vm_event_item item)
{
}
static inline void __count_vm_events(enum vm_event_item item, long delta)
{
}
static inline void all_vm_events(unsigned long *ret)
{
}
static inline void vm_events_fold_cpu(int cpu)
{
}
Annotation
- Immediate include surface: `linux/types.h`, `linux/percpu.h`, `linux/mmzone.h`, `linux/vm_event_item.h`, `linux/atomic.h`, `linux/static_key.h`, `linux/mmdebug.h`.
- Detected declarations: `struct reclaim_stat`, `struct vm_event_state`, `enum vm_stat_item`, `function __count_vm_event`, `function count_vm_event`, `function __count_vm_events`, `function count_vm_events`, `function count_vm_event`, `function zone_numa_event_add`, `function zone_numa_event_state`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.