STRUCT DAMOS_QUOTA(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 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-based esz tuning 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's nr_accesses counts 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 ms milliseconds within reset_interval for applying the action ⏳
  • if the size quota is set, DAMON tries to apply the action only up to sz bytes within reset_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 sz and uses the smaller one as the effective quota.
  • if goals is not empty, DAMON calculates yet another size quota from the goals using its internal feedback loop algorithm, for every reset_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