Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/damon: add DAMOS quota goal type for per-memcg per-node memory usage

Define a new DAMOS quota auto-tuning target metric for per-cgroup per-node
memory usage. For specifying the cgroup of the interest, add a field,
namely memcg_id, to damos_quota_goal struct.

Note that this commit is only implementing the interface. The handling of
the interface (the metric value calculation) will be implemented in the
following commit.

Link: https://lkml.kernel.org/r/20251017212706.183502-3-sj@kernel.org
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

SeongJae Park and committed by
Andrew Morton
6a18bbe4 d3946c5f

+10 -1
+10 -1
include/linux/damon.h
··· 147 147 * @DAMOS_QUOTA_SOME_MEM_PSI_US: System level some memory PSI in us. 148 148 * @DAMOS_QUOTA_NODE_MEM_USED_BP: MemUsed ratio of a node. 149 149 * @DAMOS_QUOTA_NODE_MEM_FREE_BP: MemFree ratio of a node. 150 + * @DAMOS_QUOTA_NODE_MEMCG_USED_BP: MemUsed ratio of a node for a cgroup. 150 151 * @NR_DAMOS_QUOTA_GOAL_METRICS: Number of DAMOS quota goal metrics. 151 152 * 152 153 * Metrics equal to larger than @NR_DAMOS_QUOTA_GOAL_METRICS are unsupported. ··· 157 156 DAMOS_QUOTA_SOME_MEM_PSI_US, 158 157 DAMOS_QUOTA_NODE_MEM_USED_BP, 159 158 DAMOS_QUOTA_NODE_MEM_FREE_BP, 159 + DAMOS_QUOTA_NODE_MEMCG_USED_BP, 160 160 NR_DAMOS_QUOTA_GOAL_METRICS, 161 161 }; 162 162 ··· 168 166 * @current_value: Current value of @metric. 169 167 * @last_psi_total: Last measured total PSI 170 168 * @nid: Node id. 169 + * @memcg_id: Memcg id. 171 170 * @list: List head for siblings. 172 171 * 173 172 * Data structure for getting the current score of the quota tuning goal. The ··· 182 179 * 183 180 * If @metric is DAMOS_QUOTA_NODE_MEM_{USED,FREE}_BP, @nid represents the node 184 181 * id of the target node to account the used/free memory. 182 + * 183 + * If @metric is DAMOS_QUOTA_NODE_MEMCG_USED_BP, @nid and @memcg_id represents 184 + * the node id and the cgroup to account the used memory for. 185 185 */ 186 186 struct damos_quota_goal { 187 187 enum damos_quota_goal_metric metric; ··· 193 187 /* metric-dependent fields */ 194 188 union { 195 189 u64 last_psi_total; 196 - int nid; 190 + struct { 191 + int nid; 192 + unsigned short memcg_id; 193 + }; 197 194 }; 198 195 struct list_head list; 199 196 };