STRUCT DAMON_CTX(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

struct damon_ctx(9) πŸ’–

Okay bestie, welcome to the Kernel API Manual page for struct damon_ctx β€” literally the main-character struct for DAMON monitoring contexts. No cap, iykyk. ✨


πŸŽ€ NAME πŸŽ€

struct damon_ctx β€” represents a context for each monitoring. This is the main interface that allows users to set the attributes and get the results of the monitoring. Periodt. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

struct damon_ctx {
    struct damon_attrs attrs;
    unsigned long addr_unit;
    unsigned long min_region_sz;
    bool pause;
};

✨ Members ✨

  • attrs β€” monitoring attributes for accuracy/overhead control. It’s giving β€œtune the vibe of your monitoring” energy. πŸŽ›οΈ
  • addr_unit β€” scale factor for core to ops address conversion. Yes, it converts addresses, slay. πŸ”
  • min_region_sz β€” minimum region size. Tiny regions? Not on this struct’s watch. 🐜
  • pause β€” pause the kdamond main loop. Hit pause on the whole monitoring moment. ⏸️

πŸ’œ Description πŸ’œ

For each monitoring context, one kernel thread for the monitoring is created β€” its name is kdamond, and yes, she is the moment. 🌟 The pid of kdamond can be retrieved using damon_kdamond_pid.

Once started, kdamond runs until it’s explicitly required to be terminated, or until every monitoring target is invalid. The validity of the targets is checked via the damon_operations.target_valid of ops. The termination can also be explicitly requested by calling damon_stop. To know if a kdamond is running, damon_is_running can be used. Iconic API behavior, honestly. πŸ‘‘

⚠️ Bestie, while the kdamond is running, all accesses to struct damon_ctx from a thread other than the kdamond should be made using safe DAMON APIs β€” including damon_call and damos_walk. Do not raw-dog that access. Ngl, fr fr, use the safe path. πŸ’€

🌈 SEE ALSO 🌈

Kernel file ./include/linux/damon.h β€” and the whole linked-up squad:

  • 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)
  • 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)

xoxo πŸ’‹ β€” source/version: ./include/linux, date: October 2026. Kernel API Manual out. πŸ«ΆπŸ’–

πŸ“¦ where this page comes from