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.

Dependency Surface

Detected Declarations

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

Implementation Notes