STRUCT DAMOS(9)
π NAME π
struct damos β Represents a Data Access Monitoring-based Operation Scheme. And bestie, this struct is literally the main character of DAMOS, no cap πβ¨
This page is from the Kernel API Manual, and we're about to get into it. Periodt.
β¨ SYNOPSIS β¨
struct damos {
struct damos_access_pattern pattern;
enum damos_action action;
unsigned long apply_interval_us;
struct damos_quota quota;
struct damos_watermarks wmarks;
union {
struct {
int target_nid;
struct damos_migrate_dests migrate_dests;
};
};
struct damos_stat stat;
unsigned long max_nr_snapshots;
};
π¦ Members π¦
Okay so let's meet the whole cast, because every single member matters:
patternβ Access pattern of target regions. This is how DAMON knows which regions fit.actionβdamos_actionto be applied to the target regions. It's giving "here's what we're doing to these regions" energy πapply_interval_usβ The time between applying the action. Lowkey the heartbeat of the whole scheme.quotaβ Control the aggressiveness of this scheme. The "don't do too much" safety net, fr fr.wmarksβ Watermarks for automated (in)activation of this scheme. It's literally the "wake me up when the system needs me" signal π{unnamed_union}β anonymous. It's an unnamed union, the incognito of C structs π{unnamed_struct}β anonymous. Another anonymous one, giving mysterious main character energy.target_nidβ Destination node if action is"migrate_{hot,cold}". The single-node option.migrate_destsβ Destination nodes if action is"migrate_{hot,cold}". The multi-node weighted option.statβ Statistics of this scheme. Receipts are always kept πmax_nr_snapshotsβ Upper limit ofnr_snapshotsstat. When you hit it, the scheme is deactivated.
πΈ DESCRIPTION πΈ
Okay so here's how this icon actually works. For each apply_interval_us, DAMON goes looking for regions that fit in the pattern, and then it applies action to those regions. Slay. But because we're not trying to absolutely obliterate CPU time or IO resources, quota is used to keep things in check β it controls the aggressiveness of this whole scheme, no cap π
If apply_interval_us is zero, then damon_attrs->aggr_interval is used instead. Periodt.
To keep things from doing the absolute most when they don't need to, schemes can be activated for specific system situations using wmarks. And here's the twist β if all schemes that registered to the monitoring context are inactive, DAMON literally stops monitoring either, and just repeatedly checks the watermarks. It's giving "if nobody needs me I'll just vibe and check the vibes" energy π«Ά
Now about migration targets, migrate_dests is the one that lets you specify multiple migration target nodes with different weights for migrate_hot or migrate_cold actions. And if migrate_dests is set, target_nid is ignored β it's literally not even getting a seat at the table π
But target_nid is used to set the migration target node for migrate_hot or migrate_cold actions, and in that case migrate_dests is unset. It's giving "pick a lane, bestie" β you're either doing the multi-node weighted thing or the single target node thing, not both π
Then there's this whole backstage check: before applying the action to a memory region, the struct damon_operations implementation could check pages of the region and skip the action to respect struct damos_filter. It's like a bouncer checking IDs at the door π
After applying the action to each region, stat gets updated. Always keep receipts, bestie π
And finally β if max_nr_snapshots is set as non-zero and stat.nr_snapshots is the same as or greater than it, the scheme is deactivated. It's literally the "you've done enough, go home" button π
π₯ SEE ALSO π₯
Kernel file ./include/linux/damon.h β and honestly bestie, the whole friend group is here, you should meet them:
struct damon_addr_range(9)struct damon_size_range(9)struct damon_region(9)struct damon_target(9)enum damos_action(9)enum damos_quota_goal_metric(9)struct damos_quota_goal(9)enum damos_quota_goal_tuner(9)struct damos_quota(9)enum damos_wmark_metric(9)struct damos_watermarks(9)struct damos_stat(9)enum damos_filter_type(9)struct damos_filter(9)struct damos_walk_control(9)struct damos_access_pattern(9)struct damos_migrate_dests(9)enum damon_ops_id(9)struct damon_operations(9)struct damon_intervals_goal(9)enum damon_filter_type(9)struct damon_filter(9)struct damon_probe(9)struct damon_attrs(9)struct damon_ctx(9)
Okay so that's the whole page bestie! This was the struct damos(9) manual page from October 2026, coming at you from ./include/linux β and honestly the way this whole struct ate and left no crumbs is just iconic. Hope this helped you understand DAMOS schemes better, mwah! πβ¨ππ¦πΈπ«Ά
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms