From nobody Sat Apr 4 00:12:46 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 5368F307AE3; Sat, 21 Mar 2026 18:13:53 +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=1774116833; cv=none; b=uMSax/VMmxkFJCho8fg0S1oQGhsWT5KlRmjIYxdnQanL2QAQxMV5H+cGWDxWaHTTnqNCg3Zoo/p4PjM3dGVps13z8XCc0lAcZgkjoss/+YfhmWCq61c6i5PVNm80PpZRUTVyZIyCxUCaXEpyQpbfx2kfeBYDqpyXk5IjSMrsOho= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774116833; c=relaxed/simple; bh=In9pNSVI8OEhXXcMpw7pEozpwRJ9LmKQ0qx3IoCdr7U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F4vYfrjFhzIbJrigp/5DWNX9FzC4e9+tupoQioAFnApqrnrhcRSS/LWI2nJsacWvZWvmbvOtlxWRlNIfCwmAqgFaWM/F3IxAxpURuHIq3yT5fvRJd4PVoxG/gctbRanXK4MEdUdYH1/UdfTPvA9keWrSa000HHfieW9UiJXv60Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=A+dtzIni; 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="A+dtzIni" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1867AC2BCB2; Sat, 21 Mar 2026 18:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774116833; bh=In9pNSVI8OEhXXcMpw7pEozpwRJ9LmKQ0qx3IoCdr7U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A+dtzIniz737VuBV3Q4xy+WjlaM+VX1njXxLuhhyT/HZjtxoReCzvmOvKSGoh9BqM x9OnbfmEMiLjExZia/7q8I/tiEdrsqUzYG3GxRd4ufNQsVPkuGTtlQ2T8DX9ue44R2 hCmDAxymFLHvdo6REd+Nd5mg0Sp8jbcL/0nwFaDkBkneSluFQDbNAkFP2/t08z/500 5IyBflUpaXg0QFX6Fxj5nGRpf+be31Hj0Cr4wCsGeU/7KGTKUaG7S0BhBRMTd2wqcu I9GmOQz0ciOQVsQOYGG1d6ZXGXuxEctEMCOyN4kHfK3+Dn8ROqUAacJ5D0mxTuGqjl jnqyKlHv91ZTA== 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/core: introduce damon_ctx->paused Date: Sat, 21 Mar 2026 11:13:31 -0700 Message-ID: <20260321181343.93971-2-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260321181343.93971-1-sj@kernel.org> References: <20260321181343.93971-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" DAMON supports only start and stop of the execution. When it is stopped, its internal data that it self-trained goes away. It will be useful if the execution can be paused and resumed with the previous self-trained data. Introduce per-context API parameter, 'paused', for the purpose. The parameter can be set and unset while DAMON is running and paused, using the online parameters commit helper functions (damon_commit_ctx() and damon_call()). Once 'paused' is set, the kdamond_fn() main loop does only limited works with sampling interval sleep during the works. The limited works include the handling of the online parameters update, so that users can unset the 'pause' and resume the execution when they want. It also keep checking DAMON stop conditions and handling of it, so that DAMON can be stopped while paused if needed. Signed-off-by: SeongJae Park --- include/linux/damon.h | 2 ++ mm/damon/core.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/include/linux/damon.h b/include/linux/damon.h index d9a3babbafc16..ea1649a09395d 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -787,6 +787,7 @@ struct damon_attrs { * @ops: Set of monitoring operations for given use cases. * @addr_unit: Scale factor for core to ops address conversion. * @min_region_sz: Minimum region size. + * @pause: Pause kdamond main loop. * @adaptive_targets: Head of monitoring targets (&damon_target) list. * @schemes: Head of schemes (&damos) list. */ @@ -838,6 +839,7 @@ struct damon_ctx { struct damon_operations ops; unsigned long addr_unit; unsigned long min_region_sz; + bool pause; =20 struct list_head adaptive_targets; struct list_head schemes; diff --git a/mm/damon/core.c b/mm/damon/core.c index db6c67e52d2b8..ce010009ca136 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1349,6 +1349,7 @@ int damon_commit_ctx(struct damon_ctx *dst, struct da= mon_ctx *src) if (err) return err; } + dst->pause =3D src->pause; dst->ops =3D src->ops; dst->addr_unit =3D src->addr_unit; dst->min_region_sz =3D src->min_region_sz; @@ -3003,6 +3004,14 @@ static int kdamond_fn(void *data) kdamond_call(ctx, false); if (ctx->maybe_corrupted) break; + while (ctx->pause) { + if (kdamond_need_stop(ctx)) + goto done; + kdamond_usleep(ctx->attrs.sample_interval); + /* allow caller unset pause via damon_call() */ + kdamond_call(ctx, false); + damos_walk_cancel(ctx); + } if (!list_empty(&ctx->schemes)) kdamond_apply_schemes(ctx); else --=20 2.47.3 From nobody Sat Apr 4 00:12:46 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 7BE7533EAED; Sat, 21 Mar 2026 18:13:53 +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=1774116833; cv=none; b=RqPcZQKgEVuUPyNSgX+mKaRpNFq5r4Iu32nwlpeNjqZRdTybMrYC6/QKX4TCVLcnremUKk1/k/TWDxT+ZY0ExdUs0eMBQGq10F5uJpgEqWVb99KuhKQbRqbV4A1GKDRj0v7khgG0AcxJZnlySRkQTIqQwm/4EqPjR7bitkx8iJc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774116833; c=relaxed/simple; bh=4uaA+eem3fKB2uPWGLGeH18mf1wXB30aEUf0eMGJT00=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cKuezXB52NWbSZOWv2xr6p4/8pTnAlhmYq5ob1mcq41s8u9jtO11kiNhe64JHslPZdBclGdV6HyXo3gGKn0N7w0TK+/a79Os5svGiVKTLVT/GaGjA/PPwpfPCmRG3Hi3jyDDPZ+1eEcC5RiQbAK/OiGQSF4jSYCm+i2U1c6NWpE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RB/sw3oy; 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="RB/sw3oy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B22DC2BCB0; Sat, 21 Mar 2026 18:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774116833; bh=4uaA+eem3fKB2uPWGLGeH18mf1wXB30aEUf0eMGJT00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RB/sw3oyJZzZe3oe/2j/45aVwyCuxSLgJi3y2xBXmpajajlFV/N42xDccH6B0Bics Utq+GYHtiuQYm+upce6/8fcjzApMvsgXe48QnxS0W2+Z6WqzQoHyhuXmnk5WyH6Spq nsPOT/XnwG5uzG2gAm9xAU1xXg0n9yNYKvF8OFba9jeqaG+hPb6ZdeuEg80ax++8DG KFKSqFNzOUpd9qBIM59v+IP/fTKW1AzwEEdQD9F45whiSPJexdhRMaUH3lxAAJpnYL NP8b7MsG6RhGe5oBzMN1hUUf+nfrIf1N4v62mqVR6UY31boEFpEe8lS3gm33ooKi9V XPON7qvYMTf2g== 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/sysfs: add pause file under context dir Date: Sat, 21 Mar 2026 11:13:32 -0700 Message-ID: <20260321181343.93971-3-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260321181343.93971-1-sj@kernel.org> References: <20260321181343.93971-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 pause DAMON sysfs file under the context directory. It exposes the damon_ctx->pause API parameter to the users so that they can use the pause/resume feature. Signed-off-by: SeongJae Park --- mm/damon/sysfs.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index 6a44a2f3d8fc9..51893abd09472 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -866,6 +866,7 @@ struct damon_sysfs_context { struct damon_sysfs_attrs *attrs; struct damon_sysfs_targets *targets; struct damon_sysfs_schemes *schemes; + bool pause; }; =20 static struct damon_sysfs_context *damon_sysfs_context_alloc( @@ -878,6 +879,7 @@ static struct damon_sysfs_context *damon_sysfs_context_= alloc( context->kobj =3D (struct kobject){}; context->ops_id =3D ops_id; context->addr_unit =3D 1; + context->pause =3D false; return context; } =20 @@ -1053,6 +1055,30 @@ static ssize_t addr_unit_store(struct kobject *kobj, return count; } =20 +static ssize_t pause_show(struct kobject *kobj, struct kobj_attribute *att= r, + char *buf) +{ + struct damon_sysfs_context *context =3D container_of(kobj, + struct damon_sysfs_context, kobj); + + return sysfs_emit(buf, "%c\n", context->pause ? 'Y' : 'N'); +} + +static ssize_t pause_store(struct kobject *kobj, struct kobj_attribute *at= tr, + const char *buf, size_t count) +{ + struct damon_sysfs_context *context =3D container_of(kobj, + struct damon_sysfs_context, kobj); + bool pause; + int err =3D kstrtobool(buf, &pause); + + if (err) + return err; + context->pause =3D pause; + return count; +} + + static void damon_sysfs_context_release(struct kobject *kobj) { kfree(container_of(kobj, struct damon_sysfs_context, kobj)); @@ -1067,10 +1093,14 @@ static struct kobj_attribute damon_sysfs_context_op= erations_attr =3D static struct kobj_attribute damon_sysfs_context_addr_unit_attr =3D __ATTR_RW_MODE(addr_unit, 0600); =20 +static struct kobj_attribute damon_sysfs_context_pause_attr =3D + __ATTR_RW_MODE(pause, 0600); + static struct attribute *damon_sysfs_context_attrs[] =3D { &damon_sysfs_context_avail_operations_attr.attr, &damon_sysfs_context_operations_attr.attr, &damon_sysfs_context_addr_unit_attr.attr, + &damon_sysfs_context_pause_attr.attr, NULL, }; ATTRIBUTE_GROUPS(damon_sysfs_context); @@ -1470,6 +1500,7 @@ static int damon_sysfs_apply_inputs(struct damon_ctx = *ctx, if (sys_ctx->ops_id =3D=3D DAMON_OPS_PADDR) ctx->min_region_sz =3D max( DAMON_MIN_REGION_SZ / sys_ctx->addr_unit, 1); + ctx->pause =3D sys_ctx->pause; err =3D damon_sysfs_set_attrs(ctx, sys_ctx->attrs); if (err) return err; --=20 2.47.3 From nobody Sat Apr 4 00:12:46 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 DA4CF346E46; Sat, 21 Mar 2026 18:13:53 +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=1774116833; cv=none; b=ccCbkejt+ZEe5EzXv+pNb8jpc2aIRLiTrcOmUL6vWaGSF1nlyEwqifpatxHbjbCDmsNPD8WoccnNNLK3NB9cgLKQ/fOj2HEoXmLlHXbmG3rnQTYM/RlOOYPGUv9C/jsFgxSMQcpWptaY4hxraUuzISpO9ea+daUL0l0BWZaGymg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774116833; c=relaxed/simple; bh=qt20gza/ZGfZPnGlsbY2CkGg3eBlVlFouLw/z7b3qI8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D2zD+SQuR/FXOqkSpj8R3cwaLvKzSyxDSwKKbULTsxRqxJlIGXuGvi2aYwkjUzaoaGQXAZ5BaYDP3A1NsJpqy6yYIfXSn2AiH10coZlPjgBTru+vffcX3H1OAQNay1twY9uenQZEHoitvch/UrSarC7K5XWMJsccrTiyxaVTFGc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eLNV3slL; 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="eLNV3slL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DEB1C2BCAF; Sat, 21 Mar 2026 18:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774116833; bh=qt20gza/ZGfZPnGlsbY2CkGg3eBlVlFouLw/z7b3qI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eLNV3slLgvet31x6TAf1yaL6xK7vDqZMrt7HDDWXeHWUvLdUEwA2lM2Vx1xM23V5K x/SovoUrbEEIzKL0gMYMb6k8zSXpnCmVqbuzFf+E7FQ0+uW2Z8ekdYF8XHjSIYhu3y rOqQ3NjyyIKfoGeizMNE8aZ8S8Vmk9sN/Y5+7T6k8BuDmls5fc3JAHNzTFm1S/Raap fOUSk3DeHGX0n0JH/1Vfu9RG/gIxXrL05fpDPs6SQCftB8qqk7NkmCIE5nIq+V7A7D uOnOWaNVGl18Z2Ro47DiTelLmvCwxb+YAwu12z6x6vDeSfjpJlbN5BAp500KuOKSKe Ce1bqpc5b/eaw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , "Liam R. Howlett" , David Hildenbrand , Jonathan Corbet , Lorenzo Stoakes , Michal Hocko , Mike Rapoport , Shuah Khan , Suren Baghdasaryan , Vlastimil Babka , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 03/10] Docs/mm/damon/design: update for context pause/resume feature Date: Sat, 21 Mar 2026 11:13:33 -0700 Message-ID: <20260321181343.93971-4-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260321181343.93971-1-sj@kernel.org> References: <20260321181343.93971-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 DAMON design document for the context execution pause/resume feature. Signed-off-by: SeongJae Park --- Documentation/mm/damon/design.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/des= ign.rst index afc7d52bda2f7..510ec6375178d 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -19,6 +19,13 @@ types of monitoring. To know how user-space can do the configurations and start/stop DAMON, ref= er to :ref:`DAMON sysfs interface ` documentation. =20 +Users can also request each context execution to be paused and resumed. W= hen +it is paused, the kdamond does nothing other than applying online parameter +update. + +To know how user-space can pause/resume each context, refer to :ref:`DAMON +sysfs context ` usage documentation. + =20 Overall Architecture =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --=20 2.47.3 From nobody Sat Apr 4 00:12:46 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 55026347FE1; Sat, 21 Mar 2026 18:13:54 +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=1774116834; cv=none; b=RTUE71RX0YxYEyLENmaLWGTHdGnpBK4ir7G/CcqBNwXZFp5girMNNycQOpEeUplVryCKQIl/ioitZWPXTlmjYAHz0mUMcjkI6SrpzR+2DHN44vVyQ0/mtvvC1XcvvMty03KWEXc8yVajI2y/jZM6EEV2UQ3vyf2AejalihLk3Z8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774116834; c=relaxed/simple; bh=O8n0uNGYuU+EcM7S/clzxsj2TzvWbNFjQtjX/Z2/CrA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mB9Pd88pP8xU1bA4WeN8ocPQINaJIVGjOP5cksOrs9WxhCEa/L2FM0z470//mIXLipMCL9w8hANdtwb+WOl4bqdo+jYNbBdMwR/KUm5/2WiuI/zbmaxu9CeE3Y03Ogb0Yk5fiY/62ecKlgZapRPCy5uZ0yQ2J383Zj24dEFBvTE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZrR4UXi0; 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="ZrR4UXi0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB239C2BCB3; Sat, 21 Mar 2026 18:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774116834; bh=O8n0uNGYuU+EcM7S/clzxsj2TzvWbNFjQtjX/Z2/CrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZrR4UXi0nK1kQpMZ5iRYxPX/pdwns5ZatpwG3yQgGCIEtlLCId7ZAvruFy1cgdgQi vsqZpHR+8Tc4Q/LFukZp3ZOhs7OLRbQ8PWHI7LdIoZGbN1OiKTV4tubclAklUgzT+M QZQ0LB0/UkuBUZY4xNU0HWRAxAPH2P4xp6UuQn3/iMFMkYLzEZU+5KW88m9u+CSenQ RxDXJ0GlbZ7tBjOwW5CtxYgRYmE8LlEX7u8+h1ux+IOT43agtLjbCWqpBIAszczAV5 obX3FPwi2R+N/ROTin2Vjg6dUyEKSMvrEla9dJ3JSPZMm6fkbXVgdhrL/iQk1kiUTL L7rt0DNdmKOyQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , "Liam R. Howlett" , David Hildenbrand , Jonathan Corbet , Lorenzo Stoakes , Michal Hocko , Mike Rapoport , Shuah Khan , Suren Baghdasaryan , Vlastimil Babka , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 04/10] Docs/admin-guide/mm/damon/usage: update for pause file Date: Sat, 21 Mar 2026 11:13:34 -0700 Message-ID: <20260321181343.93971-5-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260321181343.93971-1-sj@kernel.org> References: <20260321181343.93971-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 Update DAMON usage document for the DAMON context execution pause/resume feature. Signed-off-by: SeongJae Park --- Documentation/admin-guide/mm/damon/usage.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Documentation/admin-guide/mm/damon/usage.rst b/Documentation/a= dmin-guide/mm/damon/usage.rst index 534e1199cf091..bfdb717441f05 100644 --- a/Documentation/admin-guide/mm/damon/usage.rst +++ b/Documentation/admin-guide/mm/damon/usage.rst @@ -66,7 +66,8 @@ comma (","). =E2=94=82 :ref:`kdamonds `/nr_kdamonds =E2=94=82 =E2=94=82 :ref:`0 `/state,pid,refresh_ms =E2=94=82 =E2=94=82 =E2=94=82 :ref:`contexts `/nr_cont= exts - =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 :ref:`0 `/avail= _operations,operations,addr_unit + =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 :ref:`0 `/avail= _operations,operations,addr_unit, + =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 pause =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 :ref:`monitoring_att= rs `/ =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 intervals/= sample_us,aggr_us,update_us =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 =E2=94=82 = intervals_goal/access_bp,aggrs,min_sample_us,max_sample_us @@ -194,9 +195,9 @@ details). At the moment, only one context per kdamond = is supported, so only contexts// ------------- =20 -In each context directory, three files (``avail_operations``, ``operations= `` -and ``addr_unit``) and three directories (``monitoring_attrs``, ``targets`= `, -and ``schemes``) exist. +In each context directory, four files (``avail_operations``, ``operations`= `, +``addr_unit`` and ``pause``) and three directories (``monitoring_attrs``, +``targets``, and ``schemes``) exist. =20 DAMON supports multiple types of :ref:`monitoring operations `, including those for virtual a= ddress @@ -214,6 +215,9 @@ reading from the ``operations`` file. ``addr_unit`` file is for setting and getting the :ref:`address unit ` parameter of the operations set. =20 +``pause`` file is for setting and getting the :ref:`pause request +` parameter of the conte= xt. + .. _sysfs_monitoring_attrs: =20 contexts//monitoring_attrs/ --=20 2.47.3 From nobody Sat Apr 4 00:12:46 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 714BE34846D; Sat, 21 Mar 2026 18:13:54 +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=1774116834; cv=none; b=A0rpAuSjCGevnyM1Sydp/iCftw48fjcnhhaiSLl3g13+DfEcRZ6UoyzvdBz4P7NkOr8gs5nx7yLOziGEUCfoes3565insjr2So2FU9jyTbC3pXIgc0HKj6jynxd9lesyZMvhmAP0pmEq65pnBbnZelGHDjgaI7z0ehcjDg+CRrk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774116834; c=relaxed/simple; bh=acrZio7SwTIWWe0wc5YY1SpE9hMTqgCgT01pPcG9A6s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ssOHbYOacjq6C1VWwHyKYLNs9ELyXZ73pvDzGsixGvqJh3ttzmmXXmopn9Iu0Z87kKnaSjsWvwyZpEE6V2drQ6G9jzm2nbeTzzrH98BS13LT+ugb71oYCiHMb0cXMa7A9m+DIXsiny/brmc4jVhhqTWWYmc2w/2bEaf4kcwYvaw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aetrf1Uy; 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="aetrf1Uy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43515C4AF0B; Sat, 21 Mar 2026 18:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774116834; bh=acrZio7SwTIWWe0wc5YY1SpE9hMTqgCgT01pPcG9A6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aetrf1Uydmah2EizI4lkISB5+xJaT6Nm9dBOBkqWNOGduoikVochvnDQg1tvzv3RR IgbpqLSuLqL3sqI0yMR0eMNfkgVlA0ui1l/WvZAKqUfFg7aSud0iU27hYRLcFMolfR ++ckTTBOOO3w8gsrrgN/fgCLldaNCRne4/t3TT3Ed+rtp7zZ5emRChnES3pqpuEK2t 6bIMuLBO+bRNS1jVCkQla8GIAclEHMw65kD8E3j8Edw1qjd27HdCSPWyaOqYSAWssn MC12zIo15NzxLcOG+KjCrBmaKVWXk8mDqoOWLrszeFSC6vIkxsuNfu48f8RtKbwrfE JFntlnLdPqGhA== 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] Docs/ABI/damon: update for pause sysfs file Date: Sat, 21 Mar 2026 11:13:35 -0700 Message-ID: <20260321181343.93971-6-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260321181343.93971-1-sj@kernel.org> References: <20260321181343.93971-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 DAMON ABI document for the DAMON context execution pause/resume feature. Signed-off-by: SeongJae Park --- Documentation/ABI/testing/sysfs-kernel-mm-damon | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-damon b/Documentatio= n/ABI/testing/sysfs-kernel-mm-damon index 2424237ebb105..7059f540940f0 100644 --- a/Documentation/ABI/testing/sysfs-kernel-mm-damon +++ b/Documentation/ABI/testing/sysfs-kernel-mm-damon @@ -84,6 +84,13 @@ Description: Writing an integer to this file sets the 'a= ddress unit' parameter of the given operations set of the context. Reading the file returns the last-written 'address unit' value. =20 +What: /sys/kernel/mm/damon/admin/kdamonds//contexts//pause +Date: Mar 2026 +Contact: SeongJae Park +Description: Writing a boolean keyword to this file sets the 'pause' reque= st + parameter for the context. Reading the file returns the + last-written 'pause' value. + What: /sys/kernel/mm/damon/admin/kdamonds//contexts//monitoring_att= rs/intervals/sample_us Date: Mar 2022 Contact: SeongJae Park --=20 2.47.3 From nobody Sat Apr 4 00:12:46 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 B52FB34B1A8; Sat, 21 Mar 2026 18:13:54 +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=1774116834; cv=none; b=bKpz2z+Rt5EJY4z3hpS+mB81HNP9FGgrO798fGzYlQytF+/zvOIwqPeE/ebIoGlaj/IIBDXF9dVyteDt9iy1GNSsMtoc3PNzQuGMLz2fjBDIlXae9PMsapAY8WgA4cTw1DluLUPuRrKkLraLQUK/5EPm/cHFwI84gCPEUVsc7wk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774116834; c=relaxed/simple; bh=K+t0IBDIG7HXVVaXmRTS++wFYmoNTkKzAJmGYrkNPTI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=grk4TWhaPW4S1l40q/OTOFARZyWGPQ9Gmny8Au/bcR1nFqIxxxgFep56LD7hgUs1db6DME2EaOaUkfmDtgOl5KHlN2ro02czs9zXE8f/io5dVnDNQr0SBwCW8GqO+WnFQoabUr8UZUVO2CgpyTn1kqmj82aGuOY6lQqyfGF3tpY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N5Y2AxTr; 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="N5Y2AxTr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 746E5C2BCB0; Sat, 21 Mar 2026 18:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774116834; bh=K+t0IBDIG7HXVVaXmRTS++wFYmoNTkKzAJmGYrkNPTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N5Y2AxTrErzC/xpyGbWB5GoD42Vw8CeZGe/2gyPns7E1U1BC+iY64/vTLl8YUlQKr cR+xyVGy88+3waxenL8ziLiUq59Lg9Lvsu6j86YESfKJ+X9ubaqUBED+ZqiluXtOpQ 4VcKu5VO6xVElzO/rbz1iOlis13eHlq84r/E61kWKgqXQ2wm4tp6aDI8x6rrG3xZdv msAL796o1mr5c6oVQfXkR8MZxvVeFefB0xl0fBce722EW3j7KPldwWvJpAdlrEYHtY TGD9A9S/h/t850vTykm+24eILpHXnebB8Mk3bsWxHosET3IDSWr+WRIg49crE8NEGe uLwFeUf18BsMA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Brendan Higgins , David Gow , damon@lists.linux.dev, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 06/10] mm/damon/tests/core-kunit: test pause commitment Date: Sat, 21 Mar 2026 11:13:36 -0700 Message-ID: <20260321181343.93971-7-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260321181343.93971-1-sj@kernel.org> References: <20260321181343.93971-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 kunit test for commitment of damon_ctx->pause parameter that can be done using damon_commit_ctx(). Signed-off-by: SeongJae Park --- mm/damon/tests/core-kunit.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h index 9e5904c2beeb2..0030f682b23b7 100644 --- a/mm/damon/tests/core-kunit.h +++ b/mm/damon/tests/core-kunit.h @@ -1077,6 +1077,10 @@ static void damon_test_commit_ctx(struct kunit *test) KUNIT_EXPECT_EQ(test, damon_commit_ctx(dst, src), 0); src->min_region_sz =3D 4095; KUNIT_EXPECT_EQ(test, damon_commit_ctx(dst, src), -EINVAL); + src->min_region_sz =3D 4096; + src->pause =3D true; + KUNIT_EXPECT_EQ(test, damon_commit_ctx(dst, src), 0); + KUNIT_EXPECT_TRUE(test, dst->pause); damon_destroy_ctx(src); damon_destroy_ctx(dst); } --=20 2.47.3 From nobody Sat Apr 4 00:12:46 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 F045D342524; Sat, 21 Mar 2026 18:13:54 +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=1774116835; cv=none; b=o1Sfj6VuT84n4KwAABAy4P4VO8kykZTgSCA1sDtapvGUOy10pVOSYBovVEny0zKG8mqMCr8+sAlhw3xf4qZpcWqKBz1FP/SWZ8jZHGh4mdBTEVI8zxUnSvlXf9S3gW5nY73j5K4rvkE+3M/dv2b50C1izMhKW1zwgpBRt7RHnkg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774116835; c=relaxed/simple; bh=TJXeffpmshBn5e3s77gk9ewA/YmV5afqYkZ0L4RsmNM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gkC8EbYmTN9QZkjQXPBII4/EXYgCDaNNLnqh7FlsmCuyN16flVsPAaJUBdK+tc0q5cfKN++fPlZKzgEIdtR5sV8zvHX4zMjJfJqnKxjenUunwWksq8HuVscXSDEgBNw61OmvvXuzF9bP16Bux0cM42N51MCnQAHWkzRyBebg4RE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sT2FwYha; 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="sT2FwYha" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7367C4AF0B; Sat, 21 Mar 2026 18:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774116834; bh=TJXeffpmshBn5e3s77gk9ewA/YmV5afqYkZ0L4RsmNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sT2FwYha5tiOMbwsOEicRBMnwu3gOCjkbkwjo3CYq6MEfzc4PXwO0GPSbLTv0+/SV XHBdr7za67mbduLwqkL4MtU8KH+Sh3JBu+nV05kpxOy0AdXc3C0y+kVAB/yq6KWbGD SyxqCWh2JylLIXrSffzmE8ujN2QWWVCAp35aEh3MaDmhNV2NNTs2jthjcRX6gqrSVK Sr/HehNOkcVXgc+SpL0JH/ov8dg0LszJo5Uh2Xpyxdbt9ZTCcuXeErzb4P+okUuk5r pBpinHMaRBasek86/kDpHmL1DCCyO1EPgjtqs+b95C2T3rHWgVLj8DgoLtbKOIIRdH vREyyTH2BDzzw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 07/10] selftests/damon/_damon_sysfs: support pause file staging Date: Sat, 21 Mar 2026 11:13:37 -0700 Message-ID: <20260321181343.93971-8-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260321181343.93971-1-sj@kernel.org> References: <20260321181343.93971-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" DAMON test-purpose sysfs interface control Python module, _damon_sysfs, is not supporting the newly added pause file. Add the support of the file, for future test and use of the feature. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/_damon_sysfs.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/damon/_damon_sysfs.py b/tools/testing/= selftests/damon/_damon_sysfs.py index 2b4df655d9fd0..120b96ecbd741 100644 --- a/tools/testing/selftests/damon/_damon_sysfs.py +++ b/tools/testing/selftests/damon/_damon_sysfs.py @@ -604,10 +604,11 @@ class DamonCtx: targets =3D None schemes =3D None kdamond =3D None + pause =3D None idx =3D None =20 def __init__(self, ops=3D'paddr', monitoring_attrs=3DDamonAttrs(), tar= gets=3D[], - schemes=3D[]): + schemes=3D[], pause=3DFalse): self.ops =3D ops self.monitoring_attrs =3D monitoring_attrs self.monitoring_attrs.context =3D self @@ -622,6 +623,8 @@ class DamonCtx: scheme.idx =3D idx scheme.context =3D self =20 + self.pause=3Dpause + def sysfs_dir(self): return os.path.join(self.kdamond.sysfs_dir(), 'contexts', '%d' % self.idx) @@ -662,6 +665,11 @@ class DamonCtx: err =3D scheme.stage() if err is not None: return err + + err =3D write_file(os.path.join(self.sysfs_dir(), 'pause'), self.p= ause) + if err is not None: + return err + return None =20 class Kdamond: --=20 2.47.3 From nobody Sat Apr 4 00:12:46 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 39278351C0C; Sat, 21 Mar 2026 18:13:55 +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=1774116835; cv=none; b=sxVg7kQg12b0OpEELMsVd1QrWX4UrZbR7CENbOwmBNgDpbzY8bstrqjHAihQmSg5klHPk+QtfI8hIkPry+0e95misp+OBpUDuEEpFvBqSrT6mbRebO02rOu7wOF8ladQhnmzAd9PE3Abk6dVOSw0jlM6/TOCUGf6lFYqU6snekQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774116835; c=relaxed/simple; bh=9O26QoN+V9tNeSexEgjKx5Rwm+ySmwIIy3Pdsz7ovf4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TIFHAY5hDFenFMYn1ISUrUr5k6+4esQOS94t+AfWHRl5ZV4MTzkLRUt4aP4DbHK3QD0JlnBbu90bqmvwb+eS+kZMNLQuyoOtbC5mLO2lBburtE9Acyuxm5O72Xr5WsquF3Ik11Nd3mtqdfSimHUEwdYnT00lkCJW3X2+5dBNyyk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dT8d3GyB; 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="dT8d3GyB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F27ACC19421; Sat, 21 Mar 2026 18:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774116835; bh=9O26QoN+V9tNeSexEgjKx5Rwm+ySmwIIy3Pdsz7ovf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dT8d3GyB6zVZkEyl72/a+qTGJXfgfCsJ9j16RcnhPKe/l0LMckmgt3mfnxQXxc+Rc kKaUABp3Gr66ZXxL6g3/l/RA/8Vr0gNkOVXBZsLY2kPMiRTwCLdujJk17JHfWEnnFA HeuUHtqKpvqiouN+7utYbwby20NbUcR9QMICVuSByCvG8+evIQhRfdXcCJ6C8ZYjgC MU3JTo3mozQarP1bCTMdRuWiWPfj4FzCEpdda3dEzKeMOVI93BSApy++T51sahwq8H 6HaYMkAcoWpG1qhvxuoohx+HHko8iWEJmeuwpsw9/TPcfwo+FLOuQKLru9GeN1SXzR Zacd51aK8ZiaQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 08/10] selftests/damon/drgn_dump_damon_status: dump pause Date: Sat, 21 Mar 2026 11:13:38 -0700 Message-ID: <20260321181343.93971-9-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260321181343.93971-1-sj@kernel.org> References: <20260321181343.93971-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" drgn_dump_damon_status is not dumping the damon_ctx->pause parameter value, so it cannot be tested. Dump it for future tests. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/drgn_dump_damon_status.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/damon/drgn_dump_damon_status.py b/tool= s/testing/selftests/damon/drgn_dump_damon_status.py index af99b07a4f565..5b90eb8e7ef88 100755 --- a/tools/testing/selftests/damon/drgn_dump_damon_status.py +++ b/tools/testing/selftests/damon/drgn_dump_damon_status.py @@ -200,6 +200,7 @@ def damon_ctx_to_dict(ctx): ['attrs', attrs_to_dict], ['adaptive_targets', targets_to_list], ['schemes', schemes_to_list], + ['pause', bool], ]) =20 def main(): --=20 2.47.3 From nobody Sat Apr 4 00:12:46 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 73F3E3537DE; Sat, 21 Mar 2026 18:13:55 +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=1774116835; cv=none; b=YPyumgxaZ6uGEjUZeNzC7nWh2ozMFDpNBu1v9jU3DN02ram3aV0sp/XhbzHyUUjGBrHB9+plOyn3+GRx2YKN0/ruq6mrBOMDoQtwZTko6EBWMBGnGZgCsjovzggjCKKvO8Y1xIrypXgK+HKSn4KLTV7d0QxBIGmSva0tMgobLqQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774116835; c=relaxed/simple; bh=O/0+EEFKC+kJrViTx1hpFrUcUp3ITetgY1I7Ly2ASvo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Grxi9e1e5604nodqtK0YfMOQKGiL8BpeHFFDWGp2C87yW5VmPuBOra1PQUf+WSacZMd6iXGetlbiBWML/XtlB5G2zqAvbP0ctSPoPLdKa6OVEQ5i7FKzkozYfMT6c92Ktaj7J5mRB2zq6bEE4z2Y5++mUTDkvLHdGbJOO8eJ2Tw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Kor2iOVN; 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="Kor2iOVN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B7D0C2BCB2; Sat, 21 Mar 2026 18:13:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774116835; bh=O/0+EEFKC+kJrViTx1hpFrUcUp3ITetgY1I7Ly2ASvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kor2iOVNzoHJxwalPA3UN6OFYDWwAC1kmeN820N7EAGmtJnCbIv6S4kDN9nIHOG05 mpYVKOolGzmcFs+MQ44P3fHba8boPFpAwMewe93AYnPZvtbDOPf5HZwZF3/xCA/pg+ gq7dOC+FaboQe69izaNjXYEtINgs564L+7b4VTobLG+9+DRlU/L0mwXjT0dsCXka8N ZB9rA6ATE776eUg/zNe/6FvZmda0ffITAfmlzcOYThubf8PF4VmcriVZ5sH07ZZrfv oBSBqz4LpJ2yhBe+RT9MwWtZ8O7YwKRXnWdKgtlGh+KzQ9BI/4On207Wd5PKORu/Gx 0vnXK4HbEXneQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 09/10] selftests/damon/sysfs.py: check pause on assert_ctx_committed() Date: Sat, 21 Mar 2026 11:13:39 -0700 Message-ID: <20260321181343.93971-10-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260321181343.93971-1-sj@kernel.org> References: <20260321181343.93971-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 sysfs.py tests to confirm damon_ctx->pause can be set using the pause sysfs file. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/sysfs.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/damon/sysfs.py b/tools/testing/selftes= ts/damon/sysfs.py index 3aa5c91548a53..e6d34ba05893f 100755 --- a/tools/testing/selftests/damon/sysfs.py +++ b/tools/testing/selftests/damon/sysfs.py @@ -190,6 +190,7 @@ def assert_ctx_committed(ctx, dump): assert_monitoring_attrs_committed(ctx.monitoring_attrs, dump['attrs']) assert_monitoring_targets_committed(ctx.targets, dump['adaptive_target= s']) assert_schemes_committed(ctx.schemes, dump['schemes']) + assert_true(dump['pause'] =3D=3D ctx.pause, 'pause', dump) =20 def assert_ctxs_committed(kdamonds): status, err =3D dump_damon_status_dict(kdamonds.kdamonds[0].pid) --=20 2.47.3 From nobody Sat Apr 4 00:12:46 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 AD397355814; Sat, 21 Mar 2026 18:13:55 +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=1774116835; cv=none; b=AZ6s73ACvRXiIDUG1vg8U+M//khYeYXmfM5gQm3B8dDVgdbDLQyV8zOOAqXHg/Ljmb0EPqMnidhGTOo00tmc1DUNEsAKim4ABjPdD+5ha4Xd7lKkikzsKdIK2g361jwo3zhITi/tXaBKo9vqq5d4GRCds8wx//OqFX/6+YmzfDQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774116835; c=relaxed/simple; bh=8CAJmnXM5hTXIdgeoG4mgBlgGTWslXDeLQsPkAPObfQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=evqx6I4Zkvn7hNHQH5r717S/JZ3lu5buZaygCxveGtSez+0QJceEvVm8X8carRGYwk7iB1TCgDNMAwMw9yj+D+A7F0eZpiMhUnp69gJ7X9PJmo3q3s7b6TnxyJnvmkFzOWHVY19uhTTthEZ3Ib7H4z3Nc/nrB4pudYiUGmygJ2E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=e5ZylUjd; 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="e5ZylUjd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 778C1C2BCB0; Sat, 21 Mar 2026 18:13:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774116835; bh=8CAJmnXM5hTXIdgeoG4mgBlgGTWslXDeLQsPkAPObfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e5ZylUjdQnzbpGn66thpuzFmsjx7QgL20spJw599mPYV8WT0+08p4aHAJD1dceRzS PtatTga0LmJOVq9Yma+gQitzw+wqrPKva24yEhdNfArY042ApfJSvy5lS3s6uiqWD+ psUh1QbKT+1MEhcq51OADY6WPrHrBoCSscYfW4IuP3+xIHTzy1uHQee5swAxGxLU8o BX+0GiqvmuC5fyY68ZtcK0H6cgknfvipezkmLWtDoI0Dawf9PIToQQZT2V6l5SG7Q/ Qnu6rM9hXthl88sD9pEV8ER7+rTkw0FyYoW2j+hXI44uFKoXVomKcpgdhUAl2VUdy1 Rimoocr2YTtEQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 10/10] selftets/damon/sysfs.py: pause DAMON before dumping status Date: Sat, 21 Mar 2026 11:13:40 -0700 Message-ID: <20260321181343.93971-11-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260321181343.93971-1-sj@kernel.org> References: <20260321181343.93971-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" The sysfs.py test commits DAMON parameters, dump the internal DAMON state, and show if the parameters are committed as expected using the dumped state. While the dumping is ongoing, DAMON is alive. It can make internal changes including addition and removal of regions. It can therefore make a race that can result in false test results. Pause DAMON execution during the state dumping to avoid such races. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/sysfs.py | 36 ++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tools/testing/selftests/damon/sysfs.py b/tools/testing/selftes= ts/damon/sysfs.py index e6d34ba05893f..7a4cd915d5bc9 100755 --- a/tools/testing/selftests/damon/sysfs.py +++ b/tools/testing/selftests/damon/sysfs.py @@ -193,18 +193,53 @@ def assert_ctx_committed(ctx, dump): assert_true(dump['pause'] =3D=3D ctx.pause, 'pause', dump) =20 def assert_ctxs_committed(kdamonds): + ctxs_paused_for_dump =3D [] + # pause for safe state dumping + for kd in kdamonds.kdamonds: + for ctx in kd.contexts: + if ctx.pause is False: + ctx.pause =3D True + ctxs_paused_for_dump.append(ctx) + if len(ctxs_paused_for_dump) > 0: + err =3D kd.commit() + if err is not None: + print('pause fail (%s)' % err) + kdamonds.stop() + exit(1) + status, err =3D dump_damon_status_dict(kdamonds.kdamonds[0].pid) if err is not None: print(err) kdamonds.stop() exit(1) =20 + # resume contexts paused for safe state dumping + for kd in kdamonds.kdamonds: + for ctx in ctxs_paused_for_dump: + ctx.pause =3D False + if len(ctxs_paused_for_dump) > 0: + err =3D kd.commit() + if err is not None: + print('resume fail (%s)' % err) + kdamonds.stop() + exit(1) + + # restore for comparison + for ctx in ctxs_paused_for_dump: + ctx.pause =3D True + ctxs =3D kdamonds.kdamonds[0].contexts dump =3D status['contexts'] assert_true(len(ctxs) =3D=3D len(dump), 'ctxs length', dump) for idx, ctx in enumerate(ctxs): assert_ctx_committed(ctx, dump[idx]) =20 + # restore for the caller + for kd in kdamonds.kdamonds: + for ctx in kd.contexts: + if ctx in ctxs_paused_for_dump: + ctx.pause =3D False + def main(): kdamonds =3D _damon_sysfs.Kdamonds( [_damon_sysfs.Kdamond( @@ -302,6 +337,7 @@ def main(): print('kdamond start failed: %s' % err) exit(1) kdamonds.kdamonds[0].contexts[0].targets[1].obsolete =3D True + kdamonds.kdamonds[0].contexts[0].pause =3D True kdamonds.kdamonds[0].commit() del kdamonds.kdamonds[0].contexts[0].targets[1] assert_ctxs_committed(kdamonds) --=20 2.47.3