include/linux/damon.h
Source file repositories/reference/linux-study-clean/include/linux/damon.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/damon.h- Extension
.h- Size
- 41088 bytes
- Lines
- 1091
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/math64.hlinux/memcontrol.hlinux/mutex.hlinux/prandom.hlinux/time64.hlinux/types.h
Detected Declarations
struct damon_addr_rangestruct damon_size_rangestruct damon_regionstruct damon_targetstruct damos_quota_goalstruct damos_quotastruct damos_watermarksstruct damos_statstruct damos_filterstruct damon_ctxstruct damosstruct damos_walk_controlstruct damos_access_patternstruct damos_migrate_destsstruct damosstruct damon_operationsstruct damon_call_controlstruct damon_intervals_goalstruct damon_filterstruct damon_probestruct damon_attrsstruct damon_ctxenum damos_actionenum damos_quota_goal_metricenum damos_quota_goal_tunerenum damos_wmark_metricenum damos_filter_typeenum damon_ops_idenum damon_filter_typefunction damon_randfunction damon_sz_regionfunction damon_target_has_pidfunction damon_max_nr_accesses
Annotated Snippet
struct damon_addr_range {
unsigned long start;
unsigned long end;
};
/**
* struct damon_size_range - Represents size for filter to operate on [@min, @max].
* @min: Min size (inclusive).
* @max: Max size (inclusive).
*/
struct damon_size_range {
unsigned long min;
unsigned long max;
};
/**
* struct damon_region - Represents a monitoring target region.
* @ar: The address range of the region.
* @sampling_addr: Address of the sample for the next access check.
* @nr_accesses: Access frequency of this region.
* @nr_accesses_bp: @nr_accesses in basis point (0.01%) that updated for
* each sampling interval.
* @probe_hits: Number of probe-positive region samples.
* @list: List head for siblings.
* @age: Age of this region.
*
* For any use case, @ar should be non-zero positive size.
*
* @nr_accesses is reset to zero for every &damon_attrs->aggr_interval and be
* increased for every &damon_attrs->sample_interval if an access to the region
* during the last sampling interval is found. The update of this field should
* not be done with direct access but with the helper function,
* damon_update_region_access_rate().
*
* @nr_accesses_bp is another representation of @nr_accesses in basis point
* (1 in 10,000) that updated for every &damon_attrs->sample_interval in a
* manner similar to moving sum. By the algorithm, this value becomes
* @nr_accesses * 10000 for every &struct damon_attrs->aggr_interval. This can
* be used when the aggregation interval is too huge and therefore cannot wait
* for it before getting the access monitoring results.
*
* @age is initially zero, increased for each aggregation interval, and reset
* to zero again if the access frequency is significantly changed. If two
* regions are merged into a new region, both @nr_accesses and @age of the new
* region are set as region size-weighted average of those of the two regions.
*/
struct damon_region {
struct damon_addr_range ar;
unsigned long sampling_addr;
unsigned int nr_accesses;
unsigned int nr_accesses_bp;
unsigned char probe_hits[DAMON_MAX_PROBES];
struct list_head list;
unsigned int age;
/* private: Internal value for age calculation. */
unsigned int last_nr_accesses;
};
/**
* struct damon_target - Represents a monitoring target.
* @pid: The PID of the virtual address space to monitor.
* @nr_regions: Number of monitoring target regions of this target.
* @regions_list: Head of the monitoring target regions of this target.
* @list: List head for siblings.
* @obsolete: Whether the commit destination target is obsolete.
*
* Each monitoring context could have multiple targets. For example, a context
* for virtual memory address spaces could have multiple target processes. The
* @pid should be set for appropriate &struct damon_operations including the
* virtual address spaces monitoring operations.
*
* @obsolete is used only for damon_commit_targets() source targets, to specify
* the matching destination targets are obsolete. Read damon_commit_targets()
* to see how it is handled.
*/
struct damon_target {
struct pid *pid;
unsigned int nr_regions;
struct list_head regions_list;
struct list_head list;
bool obsolete;
};
/**
* enum damos_action - Represents an action of a Data Access Monitoring-based
* Operation Scheme.
*
* @DAMOS_WILLNEED: Call ``madvise()`` for the region with MADV_WILLNEED.
* @DAMOS_COLD: Call ``madvise()`` for the region with MADV_COLD.
Annotation
- Immediate include surface: `linux/math64.h`, `linux/memcontrol.h`, `linux/mutex.h`, `linux/prandom.h`, `linux/time64.h`, `linux/types.h`.
- Detected declarations: `struct damon_addr_range`, `struct damon_size_range`, `struct damon_region`, `struct damon_target`, `struct damos_quota_goal`, `struct damos_quota`, `struct damos_watermarks`, `struct damos_stat`, `struct damos_filter`, `struct damon_ctx`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
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.