From nobody Mon Feb 9 04:28:56 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9FC97354ADF; Fri, 17 Oct 2025 21:27:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736434; cv=none; b=rXc4SxvCLCx+GvWv3SJimkM+bJurQMw9h2VraMHydYyoJG1eviQwmDhOzVmcWw4GW8OiSGsA1OQti5QtJnfE61FdFUvYHi7nLx1goGcFH5XT1kybxidxd4vcIIVaps0NckLeAi8gbLDuc4k18GHmBwBlRS/38+lp0kaAWPFlCqg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736434; c=relaxed/simple; bh=aLHLz1HJxT2tP86bchmItKLfg1FQG0fbZ+VFjhe7w9w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sWmA4wU4Ez54DV9Tdsrx1ynB1sEczYkiJFF6wi90OJC58iS3Kf8SyaEhCu4w6mBfU3HAKdeRimzjoctXSrwabRYF4S90vAfHOboCLXk4vaV1bhQ71XNDVGgvme5pJU2LZaiCNtBO9cHmEyGbdO8RHhfXsZNxh1MAdxlSXbrUUXw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tFC9b+qE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tFC9b+qE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29999C4AF09; Fri, 17 Oct 2025 21:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760736434; bh=aLHLz1HJxT2tP86bchmItKLfg1FQG0fbZ+VFjhe7w9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tFC9b+qEhqdnWztJkXarAi+NxYFURzOYI1PWHkcRwhVFz7e+OHpN+oCboovEo0yNL mq0k50l7jGzMjUdGkd9ynLOvO7JARmNL+m+kUEa/F+hJ6vPBgfwSHQOAaMekIGTpkW oUkhb07u8Cb4rVqpvKdKKvg9xiuiodLHfBKDNVzHc5pRKJn6At/gFLzKq7ekOFyLwG Z/ahQKFQi2QEwn80N/mtbN1vjSXCPptw7eIWuYK6ZD3eMXTczV65m+KNCUoIbckvTM lwwM50AsLb8azsnzSMbgF0FzemJOAv5/rz05smuuUDVrAyP+n9XFSXaL8Gh4hBkRKr t5JYwcwezfXfA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 01/10] mm/damon: document damos_quota_goal->nid use case Date: Fri, 17 Oct 2025 14:26:53 -0700 Message-ID: <20251017212706.183502-2-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251017212706.183502-1-sj@kernel.org> References: <20251017212706.183502-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" damos_quota_goal kerneldoc comment is not explaining when @metric is used. Update the comment for that. Signed-off-by: SeongJae Park --- include/linux/damon.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/damon.h b/include/linux/damon.h index 1ce75a20febf..bb92c5f396cf 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -176,6 +176,9 @@ enum damos_quota_goal_metric { * If @metric is DAMOS_QUOTA_USER_INPUT, @current_value should be manually * entered by the user, probably inside the kdamond callbacks. Otherwise, * DAMON sets @current_value with self-measured value of @metric. + * + * If @metric is DAMOS_QUOTA_NODE_MEM_{USED,FREE}_BP, @nid represents the = node + * id of the target node to account the used/free memory. */ struct damos_quota_goal { enum damos_quota_goal_metric metric; --=20 2.47.3 From nobody Mon Feb 9 04:28:56 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF2C6330B31; Fri, 17 Oct 2025 21:27:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736434; cv=none; b=TbnG+NOpyjZlhC5yMbK/fSWSR4zSJufONpoTNTqi/WhZK2AW64mZOi5evazfYp/Y5erx5x/Trx1Z2xGwKDHBP4NR5pb8ZcJKC6LXUlBnSiBhyjAPTKEUfaiR4wgKeUluvM7LyxCvqL4zT3C5d8RAGPcKAS2odgpILxwB6G6kt/E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736434; c=relaxed/simple; bh=TXnOxLHlQsz7DpkuFGQ5HlVDsoXT2xlK8gPHnzDuxz0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=smP4msCxoXSFHHekHWnIipsiorpJw22VNZfostEHtxh7S+ojAoArIfkVU2Br1IUfRnE9V6gzmOrLw6evk5LCCrx3gmlP6P/jzm1phzyfcBBjGA3P642ASvG8Xl22J1lZGQwTvicvRTKPMHbdfwi/TfxH+62r6fomZ5xsVdgX4Gk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m+yN6taF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m+yN6taF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B48DC116C6; Fri, 17 Oct 2025 21:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760736434; bh=TXnOxLHlQsz7DpkuFGQ5HlVDsoXT2xlK8gPHnzDuxz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m+yN6taFSUqSAUEhHtyGiwsy1LGNCf4WWkeAhIcHgVhg0aGsOCyomXhgzmIQyipes 3NrAJ+BHdIx1HLjpRkT3VtrnIpPOAmBEQxtw6Fyku1mXu01mSRV76hzup9JESMLldh EoTlJUJkGaM/fupQiVl8U9ukruUe+mn0ZZq955LA+X5TWQnl8GSV+o8QOuk65o7TUY ZPJeGS4IycxdPsPRfefZ4qyY7efkfNnszCFoNtifsZEVNLaHS605y8GihFkkmImCfJ YXiSj2lMD12yJCrKOP1luw3pNEVPzQdMK0q6dAOrpumYRBvdEFPF256fas3AcqQSHb zmu1aLnJSUiWQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 02/10] mm/damon: add DAMOS quota goal type for per-memcg per-node memory usage Date: Fri, 17 Oct 2025 14:26:54 -0700 Message-ID: <20251017212706.183502-3-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251017212706.183502-1-sj@kernel.org> References: <20251017212706.183502-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: SeongJae Park --- include/linux/damon.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index bb92c5f396cf..862531f1a379 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -147,6 +147,7 @@ enum damos_action { * @DAMOS_QUOTA_SOME_MEM_PSI_US: System level some memory PSI in us. * @DAMOS_QUOTA_NODE_MEM_USED_BP: MemUsed ratio of a node. * @DAMOS_QUOTA_NODE_MEM_FREE_BP: MemFree ratio of a node. + * @DAMOS_QUOTA_NODE_MEMCG_USED_BP: MemUsed ratio of a node for a cgroup. * @NR_DAMOS_QUOTA_GOAL_METRICS: Number of DAMOS quota goal metrics. * * Metrics equal to larger than @NR_DAMOS_QUOTA_GOAL_METRICS are unsupport= ed. @@ -156,6 +157,7 @@ enum damos_quota_goal_metric { DAMOS_QUOTA_SOME_MEM_PSI_US, DAMOS_QUOTA_NODE_MEM_USED_BP, DAMOS_QUOTA_NODE_MEM_FREE_BP, + DAMOS_QUOTA_NODE_MEMCG_USED_BP, NR_DAMOS_QUOTA_GOAL_METRICS, }; =20 @@ -166,6 +168,7 @@ enum damos_quota_goal_metric { * @current_value: Current value of @metric. * @last_psi_total: Last measured total PSI * @nid: Node id. + * @memcg_id: Memcg id. * @list: List head for siblings. * * Data structure for getting the current score of the quota tuning goal. = The @@ -179,6 +182,9 @@ enum damos_quota_goal_metric { * * If @metric is DAMOS_QUOTA_NODE_MEM_{USED,FREE}_BP, @nid represents the = node * id of the target node to account the used/free memory. + * + * If @metric is DAMOS_QUOTA_NODE_MEMCG_USED_BP, @nid and @memcg_id repres= ents + * the node id and the cgroup to account the used memory for. */ struct damos_quota_goal { enum damos_quota_goal_metric metric; @@ -187,7 +193,10 @@ struct damos_quota_goal { /* metric-dependent fields */ union { u64 last_psi_total; - int nid; + struct { + int nid; + unsigned short memcg_id; + }; }; struct list_head list; }; --=20 2.47.3 From nobody Mon Feb 9 04:28:56 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AAB13328E9; Fri, 17 Oct 2025 21:27:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736435; cv=none; b=OK/gW1TWz8DwX5mmSRnQ6PtX15nxZgbl8dXi3uiI8otmCK43WJihgnFFhtG7FUBpwobyVC5445Bzj4vStyR5ZcEMk1iwmur82IIvFEFG2oNAlrm1H2a7T+6+ovmvZreueRWxWlOFC27ZF4F8Zq3DgLVS+y7QSc08KuLU1f1LH7w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736435; c=relaxed/simple; bh=iAAhOa8iHX+RisUCri+NFUUzCjC4h64hfHQYSXDZ2Yo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qGhNV2ZJwy1FKdAqpTT22ceiSmIA8q4nuPsdeq0cG6vC2DZfsBJp21aZttT79aP4Gf1h0PXytPPnQ5NOj2Am1kIM6RwpJz0P6Y4I8KYNQrv6uzctf3hgowCWRGgl+R+b/voCnhReK3EO0XauwtJtv+mG9pa5xVOxLaQjDi6+CJ4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ClO42DOb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ClO42DOb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D79EC16AAE; Fri, 17 Oct 2025 21:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760736434; bh=iAAhOa8iHX+RisUCri+NFUUzCjC4h64hfHQYSXDZ2Yo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ClO42DObtIDHCkighHiBPIiqG1Y9t1yUD0ZftzL3bpXV0fu1iIq6O8AWBs0LzK/r+ ibat0Nu5ckvHV+7FS9MbJ7OnU68VGC2GH6TO9uxb449RPNahkSUZ+CB91jLH6VqpmV TFmQ0MG/rUkj7H790bGAUrHG5BuhOHJA4ZIGLBQ3HM3i1ZeFbw2NcuIFzCTmIANMZ2 Gdhg7NTkL4Aadq9MuV6C7UMAjDhcQXv/4O+WZYjav9pvKpZ3aXYhzsyUHqxn67DJSZ UgP+NHEAHV6vhiKd6EKMFwYedkzxiHJyH5u2xeEZggrqJXEgG9thQNcms1OVPJN4cZ Yap3I7wPv4x1g== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 03/10] mm/damon/core: implement DAMOS_QUOTA_NODE_MEMCG_USED_BP Date: Fri, 17 Oct 2025 14:26:55 -0700 Message-ID: <20251017212706.183502-4-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251017212706.183502-1-sj@kernel.org> References: <20251017212706.183502-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Implement the handling of the new DAMOS quota goal metric for per-memcg per-node memory usage, namely DAMOS_QUOTA_NODE_MEMCG_USED_BP. The metric value is calculated as the sum of active/inactive anon/file pages of the given cgroup for a given NUMA node. Signed-off-by: SeongJae Park --- mm/damon/core.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/mm/damon/core.c b/mm/damon/core.c index dbe48e43682b..00f1686d767f 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -788,6 +789,10 @@ static void damos_commit_quota_goal_union( case DAMOS_QUOTA_NODE_MEM_FREE_BP: dst->nid =3D src->nid; break; + case DAMOS_QUOTA_NODE_MEMCG_USED_BP: + dst->nid =3D src->nid; + dst->memcg_id =3D src->memcg_id; + break; default: break; } @@ -2035,12 +2040,46 @@ static __kernel_ulong_t damos_get_node_mem_bp( numerator =3D i.freeram; return numerator * 10000 / i.totalram; } + +static unsigned long damos_get_node_memcg_used_bp( + struct damos_quota_goal *goal) +{ + struct mem_cgroup *memcg; + struct lruvec *lruvec; + unsigned long used_pages; + struct sysinfo i; + + rcu_read_lock(); + memcg =3D mem_cgroup_from_id(goal->memcg_id); + rcu_read_unlock(); + if (!memcg) { + if (goal->metric =3D=3D DAMOS_QUOTA_NODE_MEMCG_USED_BP) + return 0; + else /* DAMOS_QUOTA_NODE_MEMCG_FREE_BP */ + return 10000; + } + mem_cgroup_flush_stats(memcg); + lruvec =3D mem_cgroup_lruvec(memcg, NODE_DATA(goal->nid)); + used_pages =3D lruvec_page_state(lruvec, NR_ACTIVE_ANON); + used_pages +=3D lruvec_page_state(lruvec, NR_INACTIVE_ANON); + used_pages +=3D lruvec_page_state(lruvec, NR_ACTIVE_FILE); + used_pages +=3D lruvec_page_state(lruvec, NR_INACTIVE_FILE); + + si_meminfo_node(&i, goal->nid); + return used_pages * 10000 / i.totalram; +} #else static __kernel_ulong_t damos_get_node_mem_bp( struct damos_quota_goal *goal) { return 0; } + +static unsigned long damos_get_node_memcg_used_bp( + struct damos_quota_goal *goal) +{ + return 0; +} #endif =20 =20 @@ -2061,6 +2100,9 @@ static void damos_set_quota_goal_current_value(struct= damos_quota_goal *goal) case DAMOS_QUOTA_NODE_MEM_FREE_BP: goal->current_value =3D damos_get_node_mem_bp(goal); break; + case DAMOS_QUOTA_NODE_MEMCG_USED_BP: + goal->current_value =3D damos_get_node_memcg_used_bp(goal); + break; default: break; } --=20 2.47.3 From nobody Mon Feb 9 04:28:56 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AC09332EA4; Fri, 17 Oct 2025 21:27:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736435; cv=none; b=PVE6SaEwDHFKNdy74jtctXOP56TLdpJnc3dEJZXsBg1IWAwwdSWnyAVDiBKxGkGgX+JBgSHaDo+eaMdrIFUSfAZ+1bt4pIAfbjUult9k+NGIyiU6f2ZkzzNbfMYVnyIY+r09uKJ6q+VgdxnU2GqsRSVGked+QNpKXiWe3tX07Is= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736435; c=relaxed/simple; bh=hA+t8CYRK0aSyhr9UylseKV/5BFcvUF8pBgfXixXY6s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pvoJgyPBeGdldL06xRNYJtRoHWYh+B7zMJOm9Vjbs9i/cR/SqxXH76uf7CRt4NwiccuVPdJJembrozWDe+aXt+8zPizLgNkR5hOfc2xJT6YmVBF5URCIOC5qzhMPBBVIcIy9F/sCtiQNbmGuEnL+jnRcizDi0HepEIPHflLN6UY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iVRtgB+Z; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iVRtgB+Z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF333C116D0; Fri, 17 Oct 2025 21:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760736434; bh=hA+t8CYRK0aSyhr9UylseKV/5BFcvUF8pBgfXixXY6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iVRtgB+ZiN4XfZsXsPLqj8yZhnIbqlQOLd2cgR5NKUfC0oQjnbpwIZZ/sFpRaaNpU ImLNc7urtvZEttLUPx5rz3Dpa1Pw9nHvgZpOcLRG2vvhY7wvE/qT7cZJtaxnDs2j6c FvgP1ZCyGkp0N1tRP96OQU0qYNSMKbhlsHGR1/5UO69FgkP6oMQ1UrCGaJzWQUmX7a 7cqNMb7TcykikRA9VWs8l+7FjUXarRT6aPKAL3F9GldVQOZ4wJJvohn/WCi6s450qX LNsNVSOv4+zFHPPWl6jcrnLq9WfGxK7E8zeHeqZeeH3YohIkanM3Oe59m3nvzlxm6H gMd3pR4QJQkUA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 04/10] mm/damon/sysfs-schemes: implement path file under quota goal directory Date: Fri, 17 Oct 2025 14:26:56 -0700 Message-ID: <20251017212706.183502-5-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251017212706.183502-1-sj@kernel.org> References: <20251017212706.183502-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a DAMOS sysfs file for specifying the cgroup of the interest for DAMOS_QUOTA_NODE_MEMCG_USED_BP. Signed-off-by: SeongJae Park --- mm/damon/sysfs-schemes.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 6536f16006c9..2c440a2b80e6 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -999,6 +999,7 @@ struct damos_sysfs_quota_goal { unsigned long target_value; unsigned long current_value; int nid; + char *path; }; =20 static struct damos_sysfs_quota_goal *damos_sysfs_quota_goal_alloc(void) @@ -1128,10 +1129,39 @@ static ssize_t nid_store(struct kobject *kobj, return err ? err : count; } =20 +static ssize_t path_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + struct damos_sysfs_quota_goal *goal =3D container_of(kobj, + struct damos_sysfs_quota_goal, kobj); + + return sysfs_emit(buf, "%s\n", goal->path ? goal->path : ""); +} + +static ssize_t path_store(struct kobject *kobj, + struct kobj_attribute *attr, const char *buf, size_t count) +{ + struct damos_sysfs_quota_goal *goal =3D container_of(kobj, + struct damos_sysfs_quota_goal, kobj); + char *path =3D kmalloc_array(size_add(count, 1), sizeof(*path), + GFP_KERNEL); + + if (!path) + return -ENOMEM; + + strscpy(path, buf, count + 1); + kfree(goal->path); + goal->path =3D path; + return count; +} + static void damos_sysfs_quota_goal_release(struct kobject *kobj) { - /* or, notify this release to the feed callback */ - kfree(container_of(kobj, struct damos_sysfs_quota_goal, kobj)); + struct damos_sysfs_quota_goal *goal =3D container_of(kobj, + struct damos_sysfs_quota_goal, kobj); + + kfree(goal->path); + kfree(goal); } =20 static struct kobj_attribute damos_sysfs_quota_goal_target_metric_attr =3D @@ -1146,11 +1176,15 @@ static struct kobj_attribute damos_sysfs_quota_goal= _current_value_attr =3D static struct kobj_attribute damos_sysfs_quota_goal_nid_attr =3D __ATTR_RW_MODE(nid, 0600); =20 +static struct kobj_attribute damos_sysfs_quota_goal_path_attr =3D + __ATTR_RW_MODE(path, 0600); + static struct attribute *damos_sysfs_quota_goal_attrs[] =3D { &damos_sysfs_quota_goal_target_metric_attr.attr, &damos_sysfs_quota_goal_target_value_attr.attr, &damos_sysfs_quota_goal_current_value_attr.attr, &damos_sysfs_quota_goal_nid_attr.attr, + &damos_sysfs_quota_goal_path_attr.attr, NULL, }; ATTRIBUTE_GROUPS(damos_sysfs_quota_goal); --=20 2.47.3 From nobody Mon Feb 9 04:28:56 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78519332EA1; Fri, 17 Oct 2025 21:27:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736435; cv=none; b=rNiQ5hKIY2lyL10AWUC6uZHcCKT6WCoDQLCIAEEddWmzciLk5coC2UGN2V7dImgd03ZpC58cowzJqGqPYtqrIebWaCpL5jtWAWaMy8C+Mcp952yaZDseKTlG2Lo9638DXjDue4IOunHXo6dYKdRA0qmmdnv8eyLB5MwBomJu4/o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736435; c=relaxed/simple; bh=n763b0RvpTofaCr5BebrQgTgr0bAylRbyPom2ZqFCig=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r2wpIKLwg4VnyKDx9o8/drLHT3nZLYjaDrJVM103GQhSJYBk2in0S5/m0EtOj5svrUacW8L/iYY/BihCZvj6bsQpvRWFaTsHmzCBkZYHCrYhMkNeo3BqH6vE7Ht28IoOyZOk2ZCWhMc82gnq+KYL37r+wmfRKDhD2kO4T330lUo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bXPurDvo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bXPurDvo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0FB7C4CEF9; Fri, 17 Oct 2025 21:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760736435; bh=n763b0RvpTofaCr5BebrQgTgr0bAylRbyPom2ZqFCig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bXPurDvoVIqh6Gs78MmE9b9zfXanaNR/Zyl3bbgzgt2brOSRKT5h5EmzoXmXS8708 pgULRBZdxO/78W0f6MUUiCDe3zOlAx3VQ1EpInR+bm0eJ28d5Nf2uCz6OqYJ+nKGw3 tLnhskbnFaoR5JtWXw5TruFQP4oQbs4hdCdyKJy19gW3hD11mAlLGUVvssb/LpKbs3 GJrw5FOsg9E6sB1QHWcfbOdyNYYIxhv1Q3lnzpF7pebwDT6AfWx53aKCHrqaMGruma aeCC4uYHQGGtJ0HKvXt+pkcFZN0bbegKwbenrkG3oUfIE/PWbb6h06Dtgxv6llZFyZ ot/eb8MQm9AqQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 05/10] mm/damon/sysfs-schemes: support DAMOS_QUOTA_NODE_MEMCG_USED_BP Date: Fri, 17 Oct 2025 14:26:57 -0700 Message-ID: <20251017212706.183502-6-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251017212706.183502-1-sj@kernel.org> References: <20251017212706.183502-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support of DAMOS_QUOTA_NODE_MEMCG_USED_BP. For this, extend quota goal metric inputs for the new metric, and update DAMOS core layer request construction logic to set the target cgroup, which is specified by the user, via the 'path' file. Signed-off-by: SeongJae Park --- mm/damon/sysfs-schemes.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 2c440a2b80e6..c679e62fd4b9 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -1030,6 +1030,10 @@ struct damos_sysfs_qgoal_metric_name damos_sysfs_qgo= al_metric_names[] =3D { .metric =3D DAMOS_QUOTA_NODE_MEM_FREE_BP, .name =3D "node_mem_free_bp", }, + { + .metric =3D DAMOS_QUOTA_NODE_MEMCG_USED_BP, + .name =3D "node_memcg_used_bp", + }, }; =20 static ssize_t target_metric_show(struct kobject *kobj, @@ -2526,7 +2530,7 @@ static int damos_sysfs_add_quota_score( struct damos_quota *quota) { struct damos_quota_goal *goal; - int i; + int i, err; =20 for (i =3D 0; i < sysfs_goals->nr; i++) { struct damos_sysfs_quota_goal *sysfs_goal =3D @@ -2547,6 +2551,15 @@ static int damos_sysfs_add_quota_score( case DAMOS_QUOTA_NODE_MEM_FREE_BP: goal->nid =3D sysfs_goal->nid; break; + case DAMOS_QUOTA_NODE_MEMCG_USED_BP: + err =3D damon_sysfs_memcg_path_to_id( + sysfs_goal->path, &goal->memcg_id); + if (err) { + damos_destroy_quota_goal(goal); + return err; + } + goal->nid =3D sysfs_goal->nid; + break; default: break; } --=20 2.47.3 From nobody Mon Feb 9 04:28:56 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6384E33291F; Fri, 17 Oct 2025 21:27:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736435; cv=none; b=VlEvTPbgBgPbvNGpLog/9Kylooo5Y0ZTds0OnjN00VUVoU4yfacSp/kSVz0FiykMu6BE8IVOBRtwiGV+nviPOgdG4b35Fqm3xUz6varKKX1k4M+rUj9mjrlxChwOxNNmC8Jzy+QwLrmqo7uc0i+4S9sQ+K1JNmNmE1DyFdWQT7o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736435; c=relaxed/simple; bh=r1QRmbQ0ckNwsPpAqp/NhFI/Nrd0yqfQwVomPU13aMY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iTGRP9Hask+/mibb7FsG9/JBJmAZAa3dqt6IU5JnXqv8bJVcR3HO7xhMOo5NwozsX4ngdnZs8QYG4P7bfzIgqwOxveuYbRv8PR2bzS3vGTqgByC/ai4lCoHjNjypGRoiJIBWRpKkWG/VpWe3TcUWKwqv5iYP6aGg8fxolktrABk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m1sivf6R; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="m1sivf6R" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 309B6C4CEE7; Fri, 17 Oct 2025 21:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760736435; bh=r1QRmbQ0ckNwsPpAqp/NhFI/Nrd0yqfQwVomPU13aMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m1sivf6RmIIQvpCVclfSkMGi4RwQqfkkqwO/EvMqrM3e6n5P0vuBS65Lruodm8a+5 t1LNAPUE6FG8euuAYXE6vUvVNSbSuiGSFrW9WArIO4o3tkmf1J7534dVJmdoohiYcJ LZcDqyHKiQurrcu5H1bhVpM0kqV8EtlQTPkaR1vH0HIqo2e1UVbjQL3D+5FT7tlnOY XeHSY9ogCR6P0jmgyndjG86U+5F/HkdIuYHJDnWPaTFbsmoyjo/HxKMJXH3CkFRxwa gaqrrtZgDC6JGqgx/bjdmpV6xSXN9cJjdShYRc10I7J1p2ggtGrm5/cHFsduYzNYB7 +WkS7PnxXomhg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 06/10] mm/damon/core: add DAMOS quota gaol metric for per-memcg per-numa free memory Date: Fri, 17 Oct 2025 14:26:58 -0700 Message-ID: <20251017212706.183502-7-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251017212706.183502-1-sj@kernel.org> References: <20251017212706.183502-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a variant of DAMOS_QUOTA_NODE_MEMCG_USED_BP, for the free memory portion. The value of the metric is implemented as the entire memory of the given NUMA node subtracted by the given cgroup's usage. So from a perspective, "unused" could be a better term than "free". But arguably it is not very clear what is better, so use the term "free". Signed-off-by: SeongJae Park --- include/linux/damon.h | 6 ++++-- mm/damon/core.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/linux/damon.h b/include/linux/damon.h index 862531f1a379..9ee026c2db53 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -148,6 +148,7 @@ enum damos_action { * @DAMOS_QUOTA_NODE_MEM_USED_BP: MemUsed ratio of a node. * @DAMOS_QUOTA_NODE_MEM_FREE_BP: MemFree ratio of a node. * @DAMOS_QUOTA_NODE_MEMCG_USED_BP: MemUsed ratio of a node for a cgroup. + * @DAMOS_QUOTA_NODE_MEMCG_FREE_BP: MemFree ratio of a node for a cgroup. * @NR_DAMOS_QUOTA_GOAL_METRICS: Number of DAMOS quota goal metrics. * * Metrics equal to larger than @NR_DAMOS_QUOTA_GOAL_METRICS are unsupport= ed. @@ -158,6 +159,7 @@ enum damos_quota_goal_metric { DAMOS_QUOTA_NODE_MEM_USED_BP, DAMOS_QUOTA_NODE_MEM_FREE_BP, DAMOS_QUOTA_NODE_MEMCG_USED_BP, + DAMOS_QUOTA_NODE_MEMCG_FREE_BP, NR_DAMOS_QUOTA_GOAL_METRICS, }; =20 @@ -183,8 +185,8 @@ enum damos_quota_goal_metric { * If @metric is DAMOS_QUOTA_NODE_MEM_{USED,FREE}_BP, @nid represents the = node * id of the target node to account the used/free memory. * - * If @metric is DAMOS_QUOTA_NODE_MEMCG_USED_BP, @nid and @memcg_id repres= ents - * the node id and the cgroup to account the used memory for. + * If @metric is DAMOS_QUOTA_NODE_MEMCG_{USED,FREE}_BP, @nid and @memcg_id + * represents the node id and the cgroup to account the used memory for. */ struct damos_quota_goal { enum damos_quota_goal_metric metric; diff --git a/mm/damon/core.c b/mm/damon/core.c index 00f1686d767f..82546d138a5a 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -790,6 +790,7 @@ static void damos_commit_quota_goal_union( dst->nid =3D src->nid; break; case DAMOS_QUOTA_NODE_MEMCG_USED_BP: + case DAMOS_QUOTA_NODE_MEMCG_FREE_BP: dst->nid =3D src->nid; dst->memcg_id =3D src->memcg_id; break; @@ -2046,7 +2047,7 @@ static unsigned long damos_get_node_memcg_used_bp( { struct mem_cgroup *memcg; struct lruvec *lruvec; - unsigned long used_pages; + unsigned long used_pages, numerator; struct sysinfo i; =20 rcu_read_lock(); @@ -2066,7 +2067,11 @@ static unsigned long damos_get_node_memcg_used_bp( used_pages +=3D lruvec_page_state(lruvec, NR_INACTIVE_FILE); =20 si_meminfo_node(&i, goal->nid); - return used_pages * 10000 / i.totalram; + if (goal->metric =3D=3D DAMOS_QUOTA_NODE_MEMCG_USED_BP) + numerator =3D used_pages; + else /* DAMOS_QUOTA_NODE_MEMCG_FREE_BP */ + numerator =3D i.totalram - used_pages; + return numerator * 10000 / i.totalram; } #else static __kernel_ulong_t damos_get_node_mem_bp( @@ -2101,6 +2106,7 @@ static void damos_set_quota_goal_current_value(struct= damos_quota_goal *goal) goal->current_value =3D damos_get_node_mem_bp(goal); break; case DAMOS_QUOTA_NODE_MEMCG_USED_BP: + case DAMOS_QUOTA_NODE_MEMCG_FREE_BP: goal->current_value =3D damos_get_node_memcg_used_bp(goal); break; default: --=20 2.47.3 From nobody Mon Feb 9 04:28:56 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97955333423; Fri, 17 Oct 2025 21:27:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736435; cv=none; b=FRFIJM2sthTMix0OACStsSx5jJ/OFYhon4C6FcoC3yuqrE6Qy+uz8BGYRk/p2DT5Z9nC2CcMqM2vjNDDPPUnkb9X8TpD1ix1/JR9agzv6v3oS8L0eYgSVmGbcPcwZZfe1GoLw6KtO+7KECiUCJNZOAAsXtCACjB0MERPyqMAocw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736435; c=relaxed/simple; bh=PeYfeE2IAy0+xdX4Fi40UdJR+73VcJkJ2XijKRhczHg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gxY7DYZ/GEKJxSFJpoRoDyOACVrA+SZ+ZVXzo2HCorkyCBL0ZlKUBJMoSuNXYZPY4wnvycROFpgPAX1isHWQDN1YdXEhgaAZDeNcDiia0YfxT+XdPLATFbz8FvqHUhohiti4hENRaSZebJrCdy57Hu1IXpgV43TwJZ6IgBKcNAI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KRBgGGWz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KRBgGGWz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 626AFC116B1; Fri, 17 Oct 2025 21:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760736435; bh=PeYfeE2IAy0+xdX4Fi40UdJR+73VcJkJ2XijKRhczHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KRBgGGWzBbvi48oZxlBMJilkQ39aJ5kTPsrxNezkedQxg5ESYKEAoiBMBs23dJlZ7 iAxuFABZq4nh0DVOcsCx3oeluVIoFlLUDRJTGQgUwhbx46BQMlE4vDbCa43JuKODEw v+IkO6XF/YZK0NWK8QPx3p9wv2MGqN4VrPNaDuXaOwaCV4mQE3kjhTmG/5pqwEfm+F 18SgycU4J7Mntq5hoiAokrpztEmKXIuM1yZeNCuQv1q775St4DH/yosDqyR3/igebY 0UK0uSFPQR2+Z4VxYYIdw43Pw8Z0z8A3NGPPV1INCqCvs4M1PGndx3a5wdSDV2eex4 gSUwbiCKiX84g== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 07/10] mm/damon/sysfs-schemes: support DAMOS_QUOTA_NODE_MEMCG_FREE_BP Date: Fri, 17 Oct 2025 14:26:59 -0700 Message-ID: <20251017212706.183502-8-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251017212706.183502-1-sj@kernel.org> References: <20251017212706.183502-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Extend DAMON sysfs to support DAMOS_QUOTA_NODE_MEMCG_FREE_BP. Signed-off-by: SeongJae Park --- mm/damon/sysfs-schemes.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index c679e62fd4b9..c98cf4bd2fbb 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -1034,6 +1034,10 @@ struct damos_sysfs_qgoal_metric_name damos_sysfs_qgo= al_metric_names[] =3D { .metric =3D DAMOS_QUOTA_NODE_MEMCG_USED_BP, .name =3D "node_memcg_used_bp", }, + { + .metric =3D DAMOS_QUOTA_NODE_MEMCG_FREE_BP, + .name =3D "node_memcg_free_bp", + }, }; =20 static ssize_t target_metric_show(struct kobject *kobj, @@ -2552,6 +2556,7 @@ static int damos_sysfs_add_quota_score( goal->nid =3D sysfs_goal->nid; break; case DAMOS_QUOTA_NODE_MEMCG_USED_BP: + case DAMOS_QUOTA_NODE_MEMCG_FREE_BP: err =3D damon_sysfs_memcg_path_to_id( sysfs_goal->path, &goal->memcg_id); if (err) { --=20 2.47.3 From nobody Mon Feb 9 04:28:56 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B495333445; Fri, 17 Oct 2025 21:27:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736436; cv=none; b=XpbXytbkBz8xhRp9Wty5ynu8QZzwAMacHoEOm4eni1aRTUlO8K9sA/ATdhMcxbm7PAAJ/8SlHFLsm/InihU9M+QnsvMmW1bZbwYjvRtaIrn+TfGEyz6E1WL3VfOV/LJDOWHHzVWJ0USSKBYlVYPh+yGcTwPuHV8UzJYC7O6yZnU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736436; c=relaxed/simple; bh=V8w4yj3tuugTS097FYP8SAgCD/yVrkYxTz+kNf50q2M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Kcl3+stvo8cel+ZlSnjE9zoMvCV2XYC4PuAADpRKNNoyfHPegntdhfSdxsRtPbpoX1PpZmIOj6rlprGn0mA+Hj9fZMKOI9kqE2629RPdpMeoRPrcJllVgT45RMJCtUDByJp+4wwALRVm+0C0n5Vr6+qY19NsmTxtpjXsqe6GsDg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UT5NK01b; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UT5NK01b" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93F48C19422; Fri, 17 Oct 2025 21:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760736435; bh=V8w4yj3tuugTS097FYP8SAgCD/yVrkYxTz+kNf50q2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UT5NK01b01kbT+h4k/RxowBNijmS1AZgQgKRn0oY4+Cj6DOeCy/eMAxD5PxbcvhIE cIrRcdBvbtP2/FeCXIDZQEd86C3FcIwm/0BsO/TTnKI8sRhFxlJV4mAkiMvRgwtt+q 1m2LpO6u6oFoLbQHqM5MHvOOB3Qji1Jor9OUACyQQEM26LiQpqtHo1t3khjE9Zlav/ ACJoV+jM+tNKWdt53CBsEX0zYMvxfNFo93Yh0BrGrxhmGjoUw+VGafcXKRDaZw7fhx 2FJ0tD8RIv4wyDll8MJDNRIMea3z3/LMaqupsn38mV3FqsFHz5OMQbPCfZV4JlxcE0 Wf43xP425Iowg== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , "Liam R. Howlett" , David Hildenbrand , Jonathan Corbet , Lorenzo Stoakes , Michal Hocko , Mike Rapoport , Suren Baghdasaryan , Vlastimil Babka , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 08/10] Docs/mm/damon/design: document DAMOS_QUOTA_NODE_MEMCG_{USED,FREE}_BP Date: Fri, 17 Oct 2025 14:27:00 -0700 Message-ID: <20251017212706.183502-9-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251017212706.183502-1-sj@kernel.org> References: <20251017212706.183502-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Update design doc for the newly added two DAMOS quota auto-tuning target goal metrics, DAMOS_QUOTA_NODE_MEMCG_{USED,FREE}_BP. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/des= ign.rst index 80354f4f42ba..b54925ea78e9 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -564,9 +564,9 @@ aggressiveness (the quota) of the corresponding scheme.= For example, if DAMOS is under achieving the goal, DAMOS automatically increases the quota. If = DAMOS is over achieving the goal, it decreases the quota. =20 -The goal can be specified with four parameters, namely ``target_metric``, -``target_value``, ``current_value`` and ``nid``. The auto-tuning mechanism -tries to make ``current_value`` of ``target_metric`` be same to +The goal can be specified with five parameters, namely ``target_metric``, +``target_value``, ``current_value``, ``nid`` and ``path``. The auto-tuning +mechanism tries to make ``current_value`` of ``target_metric`` be same to ``target_value``. =20 - ``user_input``: User-provided value. Users could use any metric that th= ey @@ -581,9 +581,18 @@ tries to make ``current_value`` of ``target_metric`` b= e same to set by users at the initial time. In other words, DAMOS does self-feedb= ack. - ``node_mem_used_bp``: Specific NUMA node's used memory ratio in bp (1/10= ,000). - ``node_mem_free_bp``: Specific NUMA node's free memory ratio in bp (1/10= ,000). - -``nid`` is optionally required for only ``node_mem_used_bp`` and -``node_mem_free_bp`` to point the specific NUMA node. +- ``node_memcg_used_bp``: Specific cgroup's node used memory ratio for a + specific NUMA node, in bp (1/10,000). +- ``node_memcg_free_bp``: Specific cgroup's node unused memory ratio for a + specific NUMA node, in bp (1/10,000). + +``nid`` is optionally required for only ``node_mem_used_bp``, +``node_mem_free_bp``, ``node_memcg_used_bp`` and ``node_memcg_free_bp`` to +point the specific NUMA node. + +``path`` is optionally required for only ``node_memcg_used_bp`` and +``node_memcg_free_bp`` to point the path to the cgroup. The value should = be +the path of the memory cgroup from the cgroups mount point. =20 To know how user-space can set the tuning goal metric, the target value, a= nd/or the current value via :ref:`DAMON sysfs interface `, refe= r to --=20 2.47.3 From nobody Mon Feb 9 04:28:56 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A005333457; Fri, 17 Oct 2025 21:27:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736436; cv=none; b=B+RSOw5xuTZ40I2zralDUbEp3VzJmjB5YPGCGA+fIvow3CM135X2rpqm8VbOe2kCQVaajVlJfyiPQpIqS/tmid2DyYmTZE2oHQ0XvUZ7SLQW6VCn5UKKaNGdeSQunQyKLRzF6Hx+G8tfHU34eMkqPIqPFrk6ehQB8MRQEAIaZXk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736436; c=relaxed/simple; bh=host/mbZFT4OeHnIo2pSXmMweFfCPczlM3sHm3V1brI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Qi/juGrYMwp1A9aNSIQiLQNUZF2kEyKGvaUd257kzfrWxqGqg1ov/+Gm+4Op16XCe8EmKkfZMvaSzm+s+D3i7K9o0pZoZ2w9Z6pTW7GRKXnWDtzhCfgnxVGFnV/5Km8ymyAZvwGJ/j2k7Ut+zy+yGDqp9IPOfmZGtKtkNEkUVW0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BmDnI+Zp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BmDnI+Zp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB1FCC4CEE7; Fri, 17 Oct 2025 21:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760736436; bh=host/mbZFT4OeHnIo2pSXmMweFfCPczlM3sHm3V1brI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BmDnI+ZpiNNPmsjHtEWSkv9ZcnwkWPozf2psauxop1e/pHt9eWGb85ceQ5fkLGlX6 LIbfkJ7IHB5rCN4/zZf3L8XpvpH6dGudQ9YXrd04Q5Shsz0yeSckPtbCpw6DLPdSLG H2qgY2WsgsBlxXvsjsfgfLtBt82eEn9Fij+ojuhTkbZRY4ltkmaLB6BZ35rGL7q1WB C77fXR7MQQMUZXq2aQevv7rTEtHZ8s0oxMZ6iQ5Dy2w1AjDYgiKBgAp886W74lLGnc NjXCWCZqBmVSC351gDh7hTNUJhvmXqDbrwHvQnDjAW3vs/+r5lbUMtwyLRpzwMyV7e iKQAsRf2zB57g== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , "Liam R. Howlett" , David Hildenbrand , Jonathan Corbet , Lorenzo Stoakes , Michal Hocko , Mike Rapoport , Suren Baghdasaryan , Vlastimil Babka , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 09/10] Docs/admin-guide/mm/damon/usage: document DAMOS quota goal path file Date: Fri, 17 Oct 2025 14:27:01 -0700 Message-ID: <20251017212706.183502-10-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251017212706.183502-1-sj@kernel.org> References: <20251017212706.183502-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable A new DAMON sysfs interface file, namely 'path' has been added under DAMOS quota goal directory, for specifying the cgroup for DAMOS_QUOTA_NODE_MEMCG_{USED,FREE}_BP metrics. Document it on the usage document. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/a= dmin-guide/mm/damon/usage.rst index eae534bc1bee..98958975604d 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -81,7 +81,7 @@ comma (","). =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = :ref:`quotas `/ms,bytes,reset_interval_ms,effective_bytes =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 weights/sz_permil,nr_accesses_permil,age_permil =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 :ref:`goals `/nr_goals - =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 =E2=94=82 0/target_metric,target_value,current_value,nid + =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 =E2=94=82 0/target_metric,target_value,current_value,nid,path =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = :ref:`watermarks `/metric,interval_us,high,mid,low =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = :ref:`{core_,ops_,}filters `/nr_filters =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = =E2=94=82 0/type,matching,allow,memcg_path,addr_start,addr_end,target_idx,m= in,max @@ -402,9 +402,9 @@ number (``N``) to the file creates the number of child = directories named ``0`` to ``N-1``. Each directory represents each goal and current achievement. Among the multiple feedback, the best one is used. =20 -Each goal directory contains four files, namely ``target_metric``, -``target_value``, ``current_value`` and ``nid``. Users can set and get the -four parameters for the quota auto-tuning goals that specified on the +Each goal directory contains five files, namely ``target_metric``, +``target_value``, ``current_value`` ``nid`` and ``path``. Users can set a= nd +get the five parameters for the quota auto-tuning goals that specified on = the :ref:`design doc ` by writing to and reading from each of the files. Note that users should further write ``commit_schemes_quota_goals`` to the ``state`` file of the :ref:`kdamond --=20 2.47.3 From nobody Mon Feb 9 04:28:56 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2D3433374E; Fri, 17 Oct 2025 21:27:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736437; cv=none; b=lll3kViSIErKssFDqldw7m0vcggq/WTnxZ644rKWrle/4/va5t5iE4sVNKwfFBcUPbAe63FBBQfGnV4ie653mBMTr8Vnrwjfz19GMSn8JpEyc9PT+64BZYqCQKnB+6cd6uQaOfiEWIsAhkeeSX52LyqKLqLvlEc9PtWFSOhY7rQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760736437; c=relaxed/simple; bh=7XL7RxGNEj8c6993fvAFt0s4Fr/lZea2SH1v+aqXmgs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hutyTboHwAcWoADKi0gfQtx9LRoQeANPDhWMO2tJsxQ+J8JXScdRffrcsAKjZlPSHBZldDcZIAsckPkIvD+VJuMabA+dO3X0s7Qiffm1qR+ufQyVjmIdBSioz/yG0yAAhQePOnUohSvjQI2PI0V6M0/6Ube2Fgxj00jqGkaG22o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jgsO98Fv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jgsO98Fv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54B79C4CEF9; Fri, 17 Oct 2025 21:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1760736436; bh=7XL7RxGNEj8c6993fvAFt0s4Fr/lZea2SH1v+aqXmgs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jgsO98FvaV+BXTnvfVps7yKqGihceycqqSVJVMPwFMoebj+z6AbjR6yy+miS1xeqb I3CT+uF7OFfFcULkZQYdopgQmCG34P4QtAocVwNFA5plEujtnqanJX0RA62Zt7nas3 3YPi51UtDvyGWhxAgh5sFfsuQzqD0FWWbYa0ZQ2Rbv5q282UYaSRCZPdp/+fgqd6FA F/V6llAPmDJwZ/zV0Nk5KrnuY1WAnpbAjQb2MBmqxduVO2QzSZeenpw6jVjNKeZ2o2 FggeUkALvzrU6lo6CIneHbaOgByciKZjGLPmvTV72LRApmmdgjOK6FNOMCuCPH1xx5 h9+aR6vEVOwRQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 10/10] Docs/ABI/damon: document DAMOS quota goal path file Date: Fri, 17 Oct 2025 14:27:02 -0700 Message-ID: <20251017212706.183502-11-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251017212706.183502-1-sj@kernel.org> References: <20251017212706.183502-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A DAMON sysfs interface file for DAMOS quota goal's optional path argument has been added. Document it on the ABI doc. Signed-off-by: SeongJae Park --- Documentation/ABI/testing/sysfs-kernel-mm-damon | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-damon b/Documentatio= n/ABI/testing/sysfs-kernel-mm-damon index b6b71db36ca7..dce6c2cda4e8 100644 --- a/Documentation/ABI/testing/sysfs-kernel-mm-damon +++ b/Documentation/ABI/testing/sysfs-kernel-mm-damon @@ -303,6 +303,12 @@ Contact: SeongJae Park Description: Writing to and reading from this file sets and gets the nid parameter of the goal. =20 +What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//qu= otas/goals//path +Date: Oct 2025 +Contact: SeongJae Park +Description: Writing to and reading from this file sets and gets the path + parameter of the goal. + What: /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes//qu= otas/weights/sz_permil Date: Mar 2022 Contact: SeongJae Park --=20 2.47.3