STRUCT DAMOS_QUOTA(9)
πΈ struct damos_quota(9) πΈ
okay bestie, welcome to the Kernel API Manual β yes that's the manual name, we're fancy here π
β and today's main character is struct damos_quota, which lowkey controls how aggressive a scheme gets to be. No cap.
β¨ NAME β¨
struct damos_quota β literally the thing that controls the aggressiveness of the given scheme π
π¦ SYNOPSIS π¦
struct damos_quota {
unsigned long reset_interval;
unsigned long ms;
unsigned long sz;
enum damos_quota_goal_tuner goal_tuner;
unsigned long esz;
unsigned int fail_charge_num;
unsigned int fail_charge_denom;
unsigned int weight_sz;
unsigned int weight_nr_accesses;
unsigned int weight_age;
};
look at her. iconic. the layout is doing its own thing at the end there and we respect it π«Ά
π Members π
reset_intervalβ the charge reset interval, in milliseconds.msβ the maximum milliseconds the scheme is allowed to use.szβ the maximum bytes of memory the action can be applied to.goal_tunerβ which goal-basedesztuning algorithm to use.eszβ the effective size quota, in bytes.fail_charge_numβ numerator of the failed regions charge rate.fail_charge_denomβ denominator of the failed regions charge rate.weight_szβ how much the region's size counts for prioritization.weight_nr_accessesβ how much the region'snr_accessescounts for prioritization.weight_ageβ how much the region's age counts for prioritization.
β Description β
so the whole vibe: applying struct damos->action to a huge chunk of memory can eat WAY too much CPU time or IO resources π and DAMON is not about that life. so it lets users set time quotas and/or size quotas. you set them by writing non-zero values to ms and sz, respectively.
- if the time quota is set, DAMON tries to use only up to
msmilliseconds withinreset_intervalfor applying the action β³ - if the size quota is set, DAMON tries to apply the action only up to
szbytes withinreset_intervalπ¦
π§ the "effective quota" glow-up
to convince the different types of quotas and goals to get along, DAMON internally converts them all into one single size quota called the "effective quota." DAMON internally uses it as the only one real quota β periodt. the conversion goes like this:
- the time quota gets transformed into a size quota using the estimated throughput of the scheme's action. then DAMON compares it against
szand uses the smaller one as the effective quota. - if
goalsis not empty, DAMON calculates yet another size quota from the goals using its internal feedback loop algorithm, for everyreset_interval. then, if that new size quota is smaller than the effective quota, the new size quota becomes the effective quota.
the resulting effective size quota in bytes gets set to esz β¨
π the failed-regions charge thing
when a DAMOS action fails on an amount of regions, charging those same regions to the ones the action successfully applied is lowkey unfair, so: 'the size * fail_charge_num / fail_charge_denom' is charged. math said let's be fair π
π prioritization
for selecting regions within the quota, DAMON prioritizes the current scheme's target memory regions using the struct damon_operations->get_scheme_score. you can customize that prioritization logic by setting weight_sz, weight_nr_accesses, and weight_age β because monitoring operations are encouraged to respect those π«Ά
π SEE ALSO π
kernel file ./include/linux/damon.h, plus the whole friend group:
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)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)struct damos(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)
and that's the whole page, bestie π this one comes from ./include/linux and it's dated October 2026, filed under the very chic footer name struct damos_quota(9). slay, go read the source, ily πβ¨
π¦ 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