include/linux/memcontrol.h
Source file repositories/reference/linux-study-clean/include/linux/memcontrol.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/memcontrol.h- Extension
.h- Size
- 48193 bytes
- Lines
- 1946
- 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/cgroup.hlinux/vm_event_item.hlinux/hardirq.hlinux/jump_label.hlinux/kernel.hlinux/page_counter.hlinux/vmpressure.hlinux/eventfd.hlinux/mm.hlinux/vmstat.hlinux/writeback.hlinux/page-flags.hlinux/shrinker.h
Detected Declarations
struct mem_cgroupstruct obj_cgroupstruct pagestruct mm_structstruct kmem_cachestruct swap_cluster_infostruct mem_cgroup_reclaim_cookiestruct mem_cgroup_private_idstruct memcg_vmstats_percpustruct memcg1_events_percpustruct memcg_vmstatsstruct lruvec_stats_percpustruct lruvec_statsstruct mem_cgroup_reclaim_iterstruct mem_cgroup_per_nodestruct mem_cgroup_thresholdstruct mem_cgroup_threshold_arystruct mem_cgroup_thresholdsstruct memcg_cgwb_frnstruct obj_cgroupstruct mem_cgroupstruct slabobj_extstruct sockenum memcg_stat_itemenum memcg_memory_eventenum page_memcg_data_flagsenum objext_flagsfunction folio_memcg_chargedfunction folio_memcgfunction folio_memcg_kmemfunction PageMemcgKmemfunction mem_cgroup_is_rootfunction obj_cgroup_is_rootfunction mem_cgroup_disabledfunction mem_cgroup_protectionfunction mem_cgroup_unprotectedfunction mem_cgroup_below_lowfunction mem_cgroup_below_minfunction mem_cgroup_chargefunction mem_cgroup_chargefunction mem_cgroup_uncharge_foliosfunction folio_lruvec_lockfunction obj_cgroup_trygetfunction obj_cgroup_get_manyfunction obj_cgroup_getfunction obj_cgroup_putfunction mem_cgroup_trygetfunction mem_cgroup_tryget_online
Annotated Snippet
struct mem_cgroup_reclaim_cookie {
pg_data_t *pgdat;
int generation;
};
#ifdef CONFIG_MEMCG
#define MEM_CGROUP_ID_SHIFT 16
struct mem_cgroup_private_id {
int id;
refcount_t ref;
};
struct memcg_vmstats_percpu;
struct memcg1_events_percpu;
struct memcg_vmstats;
struct lruvec_stats_percpu;
struct lruvec_stats;
struct mem_cgroup_reclaim_iter {
struct mem_cgroup *position;
/* scan generation, increased every round-trip */
atomic_t generation;
};
/*
* per-node information in memory controller.
*/
struct mem_cgroup_per_node {
/* Keep the read-only fields at the start */
struct mem_cgroup *memcg; /* Back pointer, we cannot */
/* use container_of */
struct lruvec_stats_percpu __percpu *lruvec_stats_percpu;
struct lruvec_stats *lruvec_stats;
struct shrinker_info __rcu *shrinker_info;
#ifdef CONFIG_MEMCG_V1
/*
* Memcg-v1 only stuff in middle as buffer between read mostly fields
* and update often fields to avoid false sharing. If v1 stuff is
* not present, an explicit padding is needed.
*/
struct rb_node tree_node; /* RB tree node */
unsigned long usage_in_excess;/* Set to the value by which */
/* the soft limit is exceeded*/
bool on_tree;
#else
CACHELINE_PADDING(_pad1_);
#endif
/* Fields which get updated often at the end. */
struct lruvec lruvec;
CACHELINE_PADDING(_pad2_);
unsigned long lru_zone_size[MAX_NR_ZONES][NR_LRU_LISTS];
struct mem_cgroup_reclaim_iter iter;
/*
* objcg is wiped out as a part of the objcg repaprenting process.
* orig_objcg preserves a pointer (and a reference) to the original
* objcg until the end of live of memcg.
*/
struct obj_cgroup __rcu *objcg;
struct obj_cgroup *orig_objcg;
/* list of inherited objcgs, protected by objcg_lock */
struct list_head objcg_list;
#ifdef CONFIG_MEMCG_NMI_SAFETY_REQUIRES_ATOMIC
/* slab stats for nmi context */
atomic_t slab_reclaimable;
atomic_t slab_unreclaimable;
#endif
};
struct mem_cgroup_threshold {
struct eventfd_ctx *eventfd;
unsigned long threshold;
};
/* For threshold */
struct mem_cgroup_threshold_ary {
/* An array index points to threshold just below or equal to usage. */
int current_threshold;
/* Size of entries[] */
unsigned int size;
/* Array of thresholds */
struct mem_cgroup_threshold entries[] __counted_by(size);
};
Annotation
- Immediate include surface: `linux/cgroup.h`, `linux/vm_event_item.h`, `linux/hardirq.h`, `linux/jump_label.h`, `linux/kernel.h`, `linux/page_counter.h`, `linux/vmpressure.h`, `linux/eventfd.h`.
- Detected declarations: `struct mem_cgroup`, `struct obj_cgroup`, `struct page`, `struct mm_struct`, `struct kmem_cache`, `struct swap_cluster_info`, `struct mem_cgroup_reclaim_cookie`, `struct mem_cgroup_private_id`, `struct memcg_vmstats_percpu`, `struct memcg1_events_percpu`.
- 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.