From nobody Sat Jul 25 19:29:09 2026 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (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 62EC747DD6B for ; Tue, 14 Jul 2026 15:02:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784041372; cv=none; b=VA4IAo1kMNDFSY78YAQ38vntCT4b1TRCoxrOvQ7gNpPky5qxI3jSIcXZdm2Zy2RRk1DEVFFsTUmws+7efwwwXuG2+5nLeG1par5vHvXHU5NsnbScBIu1NsZ0F7oe0r+KWpSoWrkD886jIo7X0lYg0sYEba8VqmdU12/Rkh+5u9E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784041372; c=relaxed/simple; bh=L2EeINfl/jiQSgcT3OJXcbTSvV0sebxwv4cdOKDvpN8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rBapKhrU2MfPhYVwuHOsYe45O4Z7NzNczLSgnptnqroF9BO6lbH5hZh/yCb+UhAJP/3/j5e6MO0GJ1IPY8XgtyPXwaqPk3W7Dtdi9hm/OWtf93YmmAum//vcdpguVZvrrWPDWAyDnQkXRtPgZ0Opkbzmz7VNnNJN0mYuZIpPlLA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei-partners.com; spf=pass smtp.mailfrom=huawei-partners.com; dkim=pass (1024-bit key) header.d=huawei-partners.com header.i=@huawei-partners.com header.b=kAbHnaBT; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei-partners.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei-partners.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei-partners.com header.i=@huawei-partners.com header.b="kAbHnaBT" dkim-signature: v=1; a=rsa-sha256; d=huawei-partners.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=7udkS0ORBoH1kTobq9oFkHI6hkL3+JhRQTcgtNL2fyU=; b=kAbHnaBTwiRu1zbuyXnb8C3uIUyz9lTWISz+AeWeVft1iZbk8FxGUN3Jnl0TF9dFcbERvFePb wBl8jMs6PjmLE0llWgeLeJBeIDi6Od2QgY4mHFgUe68KzB3/kyfHGqZZ/yD2puh3XV9ofQ67Ttm 4omcuMjimuOw26/G3GTiJ9g= Received: from mail.maildlp.com (unknown [172.18.224.107]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4h02bW48qnzJ46Zl; Tue, 14 Jul 2026 23:02:31 +0800 (CST) Received: from mscpeml500003.china.huawei.com (unknown [7.188.49.51]) by mail.maildlp.com (Postfix) with ESMTPS id 5D6914058B; Tue, 14 Jul 2026 23:02:40 +0800 (CST) Received: from mscphis01197.huawei.com (10.123.65.218) by mscpeml500003.china.huawei.com (7.188.49.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 14 Jul 2026 18:02:39 +0300 From: To: , , , , , , , , , Subject: [RESEND PATCH v2 1/3] mm/damon: Introduce DAMOS_QUOTA_HUGEPAGE auto tuning Date: Tue, 14 Jul 2026 15:01:14 +0000 Message-ID: <20260714150116.382521-2-gutierrez.asier@huawei-partners.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260714150116.382521-1-gutierrez.asier@huawei-partners.com> References: <20260714150116.382521-1-gutierrez.asier@huawei-partners.com> 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 X-ClientProxiedBy: mscpeml500003.china.huawei.com (7.188.49.51) To mscpeml500003.china.huawei.com (7.188.49.51) Content-Type: text/plain; charset="utf-8" From: Asier Gutierrez Introduce DAMOS_QUOTA_HUGEPAGE_MEM_BP auto tuning. Add a new DAMOS quota goal metric to measure the amount of huge page consumption to total memory consumption ratio. Signed-off-by: Asier Gutierrez --- include/linux/damon.h | 2 ++ mm/damon/core.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/linux/damon.h b/include/linux/damon.h index f69442a9d431..a36be33a6da4 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -151,6 +151,7 @@ enum damos_action { * @DAMOS_QUOTA_INACTIVE_MEM_BP: Inactive to total LRU memory ratio. * @DAMOS_QUOTA_NODE_ELIGIBLE_MEM_BP: Scheme-eligible memory ratio of a * node in basis points (0-10000). + * @DAMOS_QUOTA_HUGEPAGE_MEM_BP: Huge page to total used memory ratio. * @NR_DAMOS_QUOTA_GOAL_METRICS: Number of DAMOS quota goal metrics. * * Metrics equal to larger than @NR_DAMOS_QUOTA_GOAL_METRICS are unsupport= ed. @@ -165,6 +166,7 @@ enum damos_quota_goal_metric { DAMOS_QUOTA_ACTIVE_MEM_BP, DAMOS_QUOTA_INACTIVE_MEM_BP, DAMOS_QUOTA_NODE_ELIGIBLE_MEM_BP, + DAMOS_QUOTA_HUGEPAGE_MEM_BP, NR_DAMOS_QUOTA_GOAL_METRICS, }; =20 diff --git a/mm/damon/core.c b/mm/damon/core.c index 6c4215cc809e..d1f0af4f02b1 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -3004,6 +3004,17 @@ static unsigned int damos_get_in_active_mem_bp(bool = active_ratio) return mult_frac(inactive, 10000, total); } =20 +static unsigned int damos_hugepage_mem_bp(void) +{ + unsigned long thp, total; + + thp =3D global_node_page_state(NR_ANON_THPS) + + global_node_page_state(NR_SHMEM_THPS) + + global_node_page_state(NR_FILE_THPS); + total =3D totalram_pages() - global_zone_page_state(NR_FREE_PAGES); + return mult_frac(thp, 10000, total); +} + static void damos_set_quota_goal_current_value(struct damon_ctx *c, struct damos *s, struct damos_quota_goal *goal) { @@ -3035,6 +3046,9 @@ static void damos_set_quota_goal_current_value(struct= damon_ctx *c, goal->current_value =3D damos_get_node_eligible_mem_bp(c, s, goal->nid); break; + case DAMOS_QUOTA_HUGEPAGE_MEM_BP: + goal->current_value =3D damos_hugepage_mem_bp(); + break; default: break; } --=20 2.43.0 From nobody Sat Jul 25 19:29:09 2026 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (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 631A948AE18 for ; Tue, 14 Jul 2026 15:02:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784041373; cv=none; b=mjRyBtVjtGR6S7XQ52z9dWZz19yNLnZRKFdkiXgbB+UHrgQEnVV5Rm5BRWvGANhhS52eu4HIYWar8ozp/J/Pn0rcOGnZ3DAee96/M5IMp3cVwbtkjiA8Db0Om2zatWNAo0QoHjFJLUJqqXc/kJhd+SugvdGKrpAx8gBpA62BzZs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784041373; c=relaxed/simple; bh=nq9tsa0TeFefdVHfC7SXyle/OhrxtDv1fiJB7BcAAWE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jxsRLge3JplypruOwjO2R5RdqNzU4xgH3PpeiVuZj+WTI+TmTsEXOF11FIVReCNlonhoAIfueo7Y7/XiG9/H7OvpDbbMmdSndkXSd1VTqIKLKwYLrUylxov8nY9OZEAfsg2q8Ngq6qEkEzzh9He5x08xGUaSDlexxyAc5fMu2PI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei-partners.com; spf=pass smtp.mailfrom=huawei-partners.com; dkim=pass (1024-bit key) header.d=huawei-partners.com header.i=@huawei-partners.com header.b=iK7wgLjs; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei-partners.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei-partners.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei-partners.com header.i=@huawei-partners.com header.b="iK7wgLjs" dkim-signature: v=1; a=rsa-sha256; d=huawei-partners.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=bY0zsgQNRGdot1/GBvs74WqAm7W6VQas7soUq+EVbIg=; b=iK7wgLjssLwLPnP0T4ETwFXjueno/++Y7R9yq89uF89iG3mOgLMpDubzCgLnf+c9eFC5jlwhK IRSp9FNYEeyjLCgFV0O23LJbJKvYzPycK3u/7mz/DP/oaADJ2Faa9zafnovPsMcLOK9G1tTCNY8 lC+Sf9o1zI8bihC6/RckxzE= Received: from mail.maildlp.com (unknown [172.18.224.107]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4h02bV00PDzHnH4Z; Tue, 14 Jul 2026 23:02:29 +0800 (CST) Received: from mscpeml500003.china.huawei.com (unknown [7.188.49.51]) by mail.maildlp.com (Postfix) with ESMTPS id 71A8340584; Tue, 14 Jul 2026 23:02:40 +0800 (CST) Received: from mscphis01197.huawei.com (10.123.65.218) by mscpeml500003.china.huawei.com (7.188.49.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 14 Jul 2026 18:02:40 +0300 From: To: , , , , , , , , , Subject: [RESEND PATCH v2 2/3] mm/damon/sysfs: support hugepage_mem_bp quota goal metric Date: Tue, 14 Jul 2026 15:01:15 +0000 Message-ID: <20260714150116.382521-3-gutierrez.asier@huawei-partners.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260714150116.382521-1-gutierrez.asier@huawei-partners.com> References: <20260714150116.382521-1-gutierrez.asier@huawei-partners.com> 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 X-ClientProxiedBy: mscpeml500003.china.huawei.com (7.188.49.51) To mscpeml500003.china.huawei.com (7.188.49.51) Content-Type: text/plain; charset="utf-8" From: Asier Gutierrez DAMOS has a new autotune policy metric: DAMOS_QUOTA_HUGEPAGE_MEM_BP. This patch exposes DAMOS_QUOTA_HUGEPAGE_MEM_BP through sysfs. Add the "hugepage_mem_bp" to the sysfs-schemes interface. Signed-off-by: Asier Gutierrez Reviewed-by: SeongJae Park --- mm/damon/sysfs-schemes.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 329cfd0bbe9f..4b5429a5b415 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -1267,6 +1267,10 @@ struct damos_sysfs_qgoal_metric_name damos_sysfs_qgo= al_metric_names[] =3D { .metric =3D DAMOS_QUOTA_NODE_ELIGIBLE_MEM_BP, .name =3D "node_eligible_mem_bp", }, + { + .metric =3D DAMOS_QUOTA_HUGEPAGE_MEM_BP, + .name =3D "hugepage_mem_bp", + }, }; =20 static ssize_t target_metric_show(struct kobject *kobj, --=20 2.43.0 From nobody Sat Jul 25 19:29:09 2026 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (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 630D548AE09 for ; Tue, 14 Jul 2026 15:02:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784041373; cv=none; b=bZXpw1TLqd/wnt3fYtAbIQnLsWXs1SgFA8a6EcdvVfQaM0IBWcJLbYPDvPF+2/R2OqG3Mn8VxFnTzkOsRBlftnS5lyMakX5JfePRDbYap3ufGsHKCH1OuZOi5UgCm7XH9RHKhkPIaT8+UCsBmQX3Vx2BG64aCGv6Sfx6+ms4A4o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784041373; c=relaxed/simple; bh=OnEai+eSSA793Nb36+z3mHxPnfn8zmSDTfU02iNNmhs=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZJPH8DBs9CEomvO6yowO8vJWKvVorSfNL/R2Ip/362DFdC8aU1YOqbKQKJWWu8/ommMaJbpTMiaEdWwEKzuDxD1Lr38EaulTBft4vLhp9PEInXLj5oktgbCKqw8InvzQzrK64kZSQsdudHJbXOV585mNZLcYzqVhl28RxQF9EA0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei-partners.com; spf=pass smtp.mailfrom=huawei-partners.com; dkim=pass (1024-bit key) header.d=huawei-partners.com header.i=@huawei-partners.com header.b=qPFJWhnh; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei-partners.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei-partners.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei-partners.com header.i=@huawei-partners.com header.b="qPFJWhnh" dkim-signature: v=1; a=rsa-sha256; d=huawei-partners.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=IT/yVAiDabUqiE4USPZqQnbFTAYiEWdtK+BgXtb/JJ0=; b=qPFJWhnhyCVI3xBc8dOhh1yOmaVoHfxNx4zX6UxJlqAqLHXI3S6qXQWbaNnx2fwSovqHzzykP BtsRjfeiDMCqW4QQF30+RAjh8kFULQnsvz+/IeDokWhUj6cJnpipsXCfu4VhnKKmDafh06ZXDXh 223hBGHDuMpRVxVi0yP6KgM= Received: from mail.maildlp.com (unknown [172.18.224.107]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4h02bW5K4BzJ46b4; Tue, 14 Jul 2026 23:02:31 +0800 (CST) Received: from mscpeml500003.china.huawei.com (unknown [7.188.49.51]) by mail.maildlp.com (Postfix) with ESMTPS id 85AC340584; Tue, 14 Jul 2026 23:02:40 +0800 (CST) Received: from mscphis01197.huawei.com (10.123.65.218) by mscpeml500003.china.huawei.com (7.188.49.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 14 Jul 2026 18:02:40 +0300 From: To: , , , , , , , , , Subject: [RESEND PATCH v2 3/3] Docs/mm/damon/design: Document hugepage_mem_bp target metric Date: Tue, 14 Jul 2026 15:01:16 +0000 Message-ID: <20260714150116.382521-4-gutierrez.asier@huawei-partners.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260714150116.382521-1-gutierrez.asier@huawei-partners.com> References: <20260714150116.382521-1-gutierrez.asier@huawei-partners.com> 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 X-ClientProxiedBy: mscpeml500003.china.huawei.com (7.188.49.51) To mscpeml500003.china.huawei.com (7.188.49.51) Content-Type: text/plain; charset="utf-8" From: Asier Gutierrez Document huge_mem_bp metric exposed by sysfs. Signed-off-by: Asier Gutierrez --- Documentation/mm/damon/design.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/des= ign.rst index 2da7ca0d3d17..34d940a13a85 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -686,6 +686,8 @@ mechanism tries to make ``current_value`` of ``target_m= etric`` be same to (1/10,000). - ``inactive_mem_bp``: Inactive to active + inactive (LRU) memory size rat= io in bp (1/10,000). +- ``hugepage_mem_bp``: Total huge page to total used memory ratio in bp + (1/10,000). =20 ``nid`` is optionally required for only ``node_mem_used_bp``, ``node_mem_free_bp``, ``node_memcg_used_bp`` and ``node_memcg_free_bp`` to --=20 2.43.0