From nobody Fri Apr 3 22:31:11 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 52C0F40DFBF; Sun, 22 Mar 2026 15:57:38 +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=1774195058; cv=none; b=VO9Di4TqRhtc3o/XYj3W3EfRDgAfa4Y9PYceoUVQ1okI9ntCwrflL2A7bFqkJg+MyQwM8qISvWJHE2yNLctuDnYMEi96DUbpizhdG8qg51KMKVPXBuU4j4b8x4YH9+A6+FVakybOS5TbPlaVFmjkWkyp9RdesqBs8XPs1H7BjgE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774195058; c=relaxed/simple; bh=3QrXyfjqZ9NePuFwbE4wZWagxs5zgqv9GB3oTqtAgRM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mU4O1wOgqtVQ5ROonJKWenumDODKtgkuKWyw3nzghgES4zqamQGL2fLO0As7lC4s5bavQCyELGlwgbkEEVtVrKujusDrRm/x3b0L/pT/WUBph47XDOItoruYFt2j1jLg6UwPnw5taPaVmLcT6CnzEM6E2ctXlN/1GmXK3f//xeI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Wz1XKTrp; 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="Wz1XKTrp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F67FC2BCB4; Sun, 22 Mar 2026 15:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774195058; bh=3QrXyfjqZ9NePuFwbE4wZWagxs5zgqv9GB3oTqtAgRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wz1XKTrpjc5jVSunEF2PXKKjeBoJl/FMlWfuA2LfY83AyKI4xzeFCepvGvaGckP13 tynRtQNuLdSLPzMPfUUWxJDKMjLjb8s/U8iF9Kx668wMB+6WupglbFdor7ydtqy/K3 5KIYrQUWiMhjVAVNprW3oGyfH90y5SC4rlnatLZPeRjmlr7dE1CoLq9YtFlpcoKiNs +OgurlwTEhtUOHTzoHeRMIOWFHNKvzMuKc8arNWRbwaUEpB9B0aIir7h0dXD5Z9uR9 ijBq5MIaW8c+bDUqDyTlT47THllXIzKvDQfpdz56bhk0ORHv5VJ2fAjqk4wJvD1dEO ihWN9cwd8KYNw== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v4 01/10] mm/damon/core: introduce damon_ctx->paused Date: Sun, 22 Mar 2026 08:57:15 -0700 Message-ID: <20260322155728.81434-2-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260322155728.81434-1-sj@kernel.org> References: <20260322155728.81434-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..0ab2cfa848e69 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) { + damos_walk_cancel(ctx); + kdamond_usleep(ctx->attrs.sample_interval); + /* allow caller unset pause via damon_call() */ + kdamond_call(ctx, false); + if (kdamond_need_stop(ctx) || ctx->maybe_corrupted) + goto done; + } if (!list_empty(&ctx->schemes)) kdamond_apply_schemes(ctx); else --=20 2.47.3 From nobody Fri Apr 3 22:31:11 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 770FF335555; Sun, 22 Mar 2026 15:57:38 +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=1774195058; cv=none; b=FeiI6N244swk1aIsmslRSFZatAjw8FKBZH35+tgjfvfp+0CT1Yv9AVm0teqPONvMZGC2kA3A/TWtES/r7FooaJWHx7e5fY6ezQ6AHCv1GoQmVMi8hc21H2ccH+8ZOwlzbK2uUj/176xeQ9jRILAF5+3Kilm4pF8XYebv5naB1VU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774195058; c=relaxed/simple; bh=4uaA+eem3fKB2uPWGLGeH18mf1wXB30aEUf0eMGJT00=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Pyi/qi6x6Kyjld2JGKWwicn5CXlgmHzzN5Xd0Ijxlm4GZHBNag0y7AN7dbMQ+fhpBr/t/Rw3h9+wx9QPXN4r1mNo5KayJk2jlhh53yoXKgIQB/0bACaoXx1NNSMzFmII7BdXe/ZOCZQVFAdL6DQRXcOD3aGad9QYdMw70nTEH18= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mcWBUA0v; 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="mcWBUA0v" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45132C2BCB7; Sun, 22 Mar 2026 15:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774195058; bh=4uaA+eem3fKB2uPWGLGeH18mf1wXB30aEUf0eMGJT00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mcWBUA0v1S+nQq/xWMdSkunC1QXnJA9K5/R6qIdXOda8x4pe3Qw65DmIG1X0zFdb8 ECow1YHbNKW6fBpHW0z2V26PgttJJ5a+ZJmp/H4V/V07WmvIiIUDw2h6RM5/o8XbBd 7VJy4tMFPEX/VVf3WiWYeUchdUHmSigjbglemysSLFuOETdvGejrow3zouTXLiiZi+ 9hFyFeIucYjVYph+ndoYqvE8mt74zqts4HKe/7Zk/dEltm/J2pvDEma0RMjMEzC5kz NuhQEBTjEkqqrLd9vyib2/WKQL7YljFbtmvzzg1fRwD06Bg9bfsq7wEGN8kDU5F28i Wn5luw/D2CKrQ== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v4 02/10] mm/damon/sysfs: add pause file under context dir Date: Sun, 22 Mar 2026 08:57:16 -0700 Message-ID: <20260322155728.81434-3-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260322155728.81434-1-sj@kernel.org> References: <20260322155728.81434-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 Fri Apr 3 22:31:11 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 DB6D33644DB; Sun, 22 Mar 2026 15:57:38 +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=1774195058; cv=none; b=FoM/F13NTcpkLZO1M5gxN7nrm2/9KJPohZRLIex0VkIK8YFwx/UBLz/z9xNlbxRyfCoAKcNA20Kw02mRCd9G8MsAfbMdtFMEspvRrFhmXc/lu+oW8qVYYdpibPygxs6OmCrXgou7ny2bjrkJjkFfFTWh7bvszESXXmpADDQmdng= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774195058; c=relaxed/simple; bh=qt20gza/ZGfZPnGlsbY2CkGg3eBlVlFouLw/z7b3qI8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QeVz1AfOSvNCTblK/uHXKcFwC7SydKSh9IJU+nU3oez9KV6x8xe+MHdMwprO5rubW45Ab82EZ31yO9CRdwjbZX5igpSGF1Fwj8mc3Ayk7PuftRsMU+peKctajYUtr+tyyf+MCDCNskoPcfNQ/eBNWO0ndNSOOKoDuycN3ll9nR4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Rx5CvT34; 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="Rx5CvT34" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AB1DC2BCB2; Sun, 22 Mar 2026 15:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774195058; bh=qt20gza/ZGfZPnGlsbY2CkGg3eBlVlFouLw/z7b3qI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rx5CvT34RmOppQtu6QxfqLWQzRWwbcWgOty3/B822ykfngK25Ar5ud10emwDWJIzS xrEbTwTN4Mx+Ijeq6WJ6Cfopp16atDTZN0nQ/OHcImSj1OlTi2Zs31rLD9SSMvBOUP erd9CvY3+Rt/aaYAN9stVROOuOWyOuRAVQRbrDGv/ac7nryJP42qaCjaRszDv9iYF7 a+VXzrHsDhX3ny7VVnAM5c/lM4uZqcHI8g5ll/L2LUGj4cD5ei4CiRjVPasL4mABVv 7o8+fEfU1WfOa0hEGojJo8HqcsfbDBMjUKChQJfl/1aCCoUVAD3/Ji8qlovGLWLuH2 DhGyAe/DjdiQw== From: SeongJae Park To: Cc: SeongJae Park , "Liam R. Howlett" , Andrew Morton , 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: [RFC PATCH v4 03/10] Docs/mm/damon/design: update for context pause/resume feature Date: Sun, 22 Mar 2026 08:57:17 -0700 Message-ID: <20260322155728.81434-4-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260322155728.81434-1-sj@kernel.org> References: <20260322155728.81434-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 Fri Apr 3 22:31:11 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 6E64936683B; Sun, 22 Mar 2026 15:57:39 +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=1774195059; cv=none; b=jGazzuBzTZmTeVRx8c9KgWUWSipSOsT2kHxL4Ivzs89bCSXb4MRc9QwryBXp/hzewR+Uez3clJeZOdIcnyVfNE2rS45kWR7hSc9+MB9YiaQjsuTcRBmK3vstmwYq+N8RXftVOVAcYL3BdUZl3N60Otd5FbcShSWFnL2lrloUe30= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774195059; 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=A5kTS4nEPHCf/V9SSct0K9i8REtiv7WW2ZkDWA//k+UXdHgfMexpxeS6fD1k7OVi0yozQAY74GagjswkxHrqYKqlgFHPmDnTpue1VYeRbBz7kcEh7mFx9BtsShnxipmWfFS1vmZHsygu4NnWuaSHVxhZ5voKctR0kYfw1vzpBRA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eZa9dF/P; 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="eZa9dF/P" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE4D9C2BCC4; Sun, 22 Mar 2026 15:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774195059; bh=O8n0uNGYuU+EcM7S/clzxsj2TzvWbNFjQtjX/Z2/CrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eZa9dF/PTZqfcuuwERyLMtEKke04eXBoVy+mBACmc3MJoLG6xi34p5YRBfgvLS9Xf rRmsN8yIbrBa69OTzlIZ4dTkX2Qszv+c3jagCu0H12ZBNz1u0wP9ggSbbziCFbSxR+ hv+RY5dRr9Wmld1wzLZ7XHbP+9EDkeDY9CoWPa9pH/w11DBTn8GIFWVEDJexZODQ24 bp5cY7V8LRby7fvQMh4Ac736jUYBF64WwU7SsrRNkS4Kxv0neyc5Ge602Oqtcyt+Y7 7Gs8xUpFo6x0HBqzkCu2fLAs4HwPaLakXbuF9QZhcEXQRtVA/+igIHpZu0EgHfvhOl reWQzxtS+yrhw== From: SeongJae Park To: Cc: SeongJae Park , "Liam R. Howlett" , Andrew Morton , 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: [RFC PATCH v4 04/10] Docs/admin-guide/mm/damon/usage: update for pause file Date: Sun, 22 Mar 2026 08:57:18 -0700 Message-ID: <20260322155728.81434-5-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260322155728.81434-1-sj@kernel.org> References: <20260322155728.81434-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 Fri Apr 3 22:31:11 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 87B2D367F4A; Sun, 22 Mar 2026 15:57:39 +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=1774195059; cv=none; b=LVLQuuWwWfRopMzbrzJmBevHeLsqWLtVhit/fejETkCbA37m9dqDkJHBPjBZ7ltKIVMfb/7fqW/RG5N0lAp4l4dFxBls/RHKOTrwWEOPw8S/+yej7NPBGE44KamQN9yjUs2qfpGCmGxWfCNGsQUosCIg1YFaHFP9PMXc+uuY730= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774195059; c=relaxed/simple; bh=acrZio7SwTIWWe0wc5YY1SpE9hMTqgCgT01pPcG9A6s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cDAqjstE1b3KZdTdRCDVixG79iYXFFDDnGyYdbeJjCjIuVNLlODLWTiwyWWZAFqJ/qFvL869A1iYx90zNaF1QkemTkk5T6ApplBXl6GFpiw42xqBBRMre0JRXFlesnZK+3x8XjmULnVnf13SMrlStRYH2gRyNYzcXSvokYjOx1I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=n4ip5v5f; 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="n4ip5v5f" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C845C4AF0B; Sun, 22 Mar 2026 15:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774195059; bh=acrZio7SwTIWWe0wc5YY1SpE9hMTqgCgT01pPcG9A6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n4ip5v5fJA3sWZJH3LAiEQvd95/Sr8atcd0zE1wUrvqBIJvlfFkZHFMPUjwJR8mWo MnhDjMZ9158HqxUssR3dY5SQKl/BOizkDhD/nbtsrspS4dEn1LRunxghRws/GSz3Ua vuz2bp/j70lLwEfBLsXPv9v7nh0h+1LQAhzPfOa+QxwdbiLYvXCCdKrHJOa0rIsIT2 PMc/7ntfk5vmZhgs+2ILmvSuHp3Q/TDDv4bxLIrj58LYA5wbdRJdR+6MtZyZOTF0Xt +6BJwjtUv1dMCgzP02NcBIfiIzhvo4RC6gAU9OX9RdVNnAiANJ4VtPEeG5UzJFb9Yk t/i+u6ZZcI0hw== From: SeongJae Park To: Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v4 05/10] Docs/ABI/damon: update for pause sysfs file Date: Sun, 22 Mar 2026 08:57:19 -0700 Message-ID: <20260322155728.81434-6-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260322155728.81434-1-sj@kernel.org> References: <20260322155728.81434-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 Fri Apr 3 22:31:11 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 C361E347C6; Sun, 22 Mar 2026 15:57:39 +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=1774195059; cv=none; b=NGSZmkxPXVedH8gWZcTwH0kUpDkF3Z3prnhfVCiaFuAsU2iZUt7dUGYLn2cJFjFUE7nxRLWfWy5K02TSw0gj7SLuwK5mx650SseMVF8v3x+QSm1MNBDDcqs2/LwejBfA6GhV737YmgJCuvHcUOxWPcmop7/887MVIIfRKPLbQvE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774195059; c=relaxed/simple; bh=K+t0IBDIG7HXVVaXmRTS++wFYmoNTkKzAJmGYrkNPTI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W/wWXXgvh1XP1xmPkJk0Ivgqa3F2kSz3CByaCJP+4QDBeImOXP+OUVHS4iJHKEfI+A/Z35iJu5qOMOrw9L/9aE8w2dRvfn2S85U4D3zx4JRI15IBnGPvP0MYE5WWwyeVwMWcVbktwbFeGDsuYQHqWbwNJ2orbCKgPJuP3fUPC8M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PlVO6kot; 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="PlVO6kot" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D7B3C2BCC6; Sun, 22 Mar 2026 15:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774195059; bh=K+t0IBDIG7HXVVaXmRTS++wFYmoNTkKzAJmGYrkNPTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PlVO6kotRB2q3CldQyLv7KHE+7VPRz/p+DA8T7h7XuvebgwkB/YfZ4rc9uFFn+5oS PKLtSA2r/hREk96rf+oI/aa1mAk+AX1KWX/omEpu9IUgVgcnCETMEy4GmC8fMD6veX 9JBirr7VSHWsinjEQOayzsxfzh5VpjhLhKVI2KDFWufdbPjr9RDjBaNqBZXwWdVDzh AMRW7j26eB0SlesuJJ2L645Tx5uTtie1QrDCFOTSiM/xsab05ey902c5XtWT/PrMqf Y5UqV94+HSqU7Pqz+NErvWwNHlNShJeJpdBcGKQGHjf/KILapzuWKlNvBuA3LOi9Cp WquMcsL5okGXQ== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , 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: [RFC PATCH v4 06/10] mm/damon/tests/core-kunit: test pause commitment Date: Sun, 22 Mar 2026 08:57:20 -0700 Message-ID: <20260322155728.81434-7-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260322155728.81434-1-sj@kernel.org> References: <20260322155728.81434-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 Fri Apr 3 22:31:11 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 13998369215; Sun, 22 Mar 2026 15:57:40 +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=1774195060; cv=none; b=cI0ZBie30W6J2Cie2VJNdt08dMiyHuGRq2lk3JGwg4fl3yT3IFdWVvfc4cJsCIryYJGAfLZHtTz/kBz6YJ6twXmGf5z80bF5R8plySoEDtYt95rYM/LjZIJSvm7Z6G0dDq8e93rCqld6ZEcsW2Gus5bbOsWVKpe+BM5RiUmQ8uo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774195060; c=relaxed/simple; bh=TJXeffpmshBn5e3s77gk9ewA/YmV5afqYkZ0L4RsmNM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=plTxos8lxey6fJ2BEYRIG8iRVoGlm0XllnvGRP9RUrSkraktXgvHnkilAMgHT9NX7bmSbCpeif/GFqI2KyATqpBXhgSqME9a7Xx57BffdRH9k3K/ZVfA6gtoyOrKe37KObN998LVr4bDvwWQH81zqhqZvlhCy3W0AJ08+k/B678= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZHJ2sj23; 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="ZHJ2sj23" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5E5EC2BC9E; Sun, 22 Mar 2026 15:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774195059; bh=TJXeffpmshBn5e3s77gk9ewA/YmV5afqYkZ0L4RsmNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZHJ2sj23DigXs7UNnB8scp4b1R5teRP/kfsRblrOXT7t1dgqcFt5alC5ubkPWIj4c 1sXN65f6+trlmBlZPz6r3+vsWsif5v4IZZYk8dB1FrdWpUEaiBfQTjxnhzANzUcZJP 0o9oVNsYVYpCYuRYJE5Ma5VSF4zVp42KoVIAM8gVr36aUdt8p02IaiOgpRZuPVx/oq 3g+otQEoBe5QZR2jDxEUN811UKlSXt/mW4UImEf0j5PWVkoUumF1b2F9cHoPzNYi0Z bIl5ukJdyDPjmeA1WK2EFQWXz8uNJJq/BIo2YtN1h7ADYrZGcL93LQTTxFKCqHln88 6rSxrr2ZhZ+Cw== From: SeongJae Park To: Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v4 07/10] selftests/damon/_damon_sysfs: support pause file staging Date: Sun, 22 Mar 2026 08:57:21 -0700 Message-ID: <20260322155728.81434-8-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260322155728.81434-1-sj@kernel.org> References: <20260322155728.81434-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 Fri Apr 3 22:31:11 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 62CBA36999F; Sun, 22 Mar 2026 15:57:40 +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=1774195060; cv=none; b=uKQoclbX6rdDYGusip+1julFU/upqQr5XV7TWhwhtBIen1zGP53kkJ9tiSXlNdWWAGFEBtl50uPy2yygZIlWDl/andZ+lBLdi3TeER9nJatvwHTn8lb7xeXrC603eUOTSmEShqsNXeJm0gUWkgyer4BUAov+3o04wumk1relTs0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774195060; c=relaxed/simple; bh=9O26QoN+V9tNeSexEgjKx5Rwm+ySmwIIy3Pdsz7ovf4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EXN4xjZrzmgLvbxESnFjT72Y35BD74yJWRF8HjFLaYfXiYRyz8AYrMBhwZBCk3opw/gySP5EJ3MMn9aRrQAOz0CrPbjPQCl+KoTQNOrX13SPWUBDICVqfvhOWynPYeJUEA89fX0hyIK29ARHMG4p2QuyI1b84S/R+tUT1ta87jc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=j/v77JDa; 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="j/v77JDa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D302C19424; Sun, 22 Mar 2026 15:57:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774195060; bh=9O26QoN+V9tNeSexEgjKx5Rwm+ySmwIIy3Pdsz7ovf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j/v77JDa6gOV0lKhY/HqDDAGc1NKfWFTNAZfuguz6CCxPJmvyDQVRt9oFIHTZZr/P vj3HzRacvDG+drDY7jd6OZz7cb52PzTKso4PlOROx9wBAyrX9oforAuK3jXCL1+Cdq G0x1Bjm0b5I8rTP3lSSVGraBs6jZQy7uFKgwldR+B/6UFwKcZKrUFlH3lAO3jpH24d AE8iGXzMnZGgY3lxI3GD7GYDKAkaQ5rIQG/2E8JRWsVgRoa64+6uoi6TeEdvHUjoi8 Oolrva4ykbCNVDA+9HmgbaSaeFl96aqjokbB7nnK0mXs9vtwcKmTEIOf6FSUjDqG7V J28pqhmX6kJpA== From: SeongJae Park To: Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v4 08/10] selftests/damon/drgn_dump_damon_status: dump pause Date: Sun, 22 Mar 2026 08:57:22 -0700 Message-ID: <20260322155728.81434-9-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260322155728.81434-1-sj@kernel.org> References: <20260322155728.81434-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 Fri Apr 3 22:31:11 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 989EA36AB44; Sun, 22 Mar 2026 15:57:40 +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=1774195060; cv=none; b=I3U1ZUwbOn0ZHGj6POt27qK8rC13RHSuPz1YjlHcPkyXYl6NIRBgtrsa/fdm3llCk1M+SAiL9cuZGeQ2lxHnnjysNr7upuFmUJowzL1swOCTYO6hx9eTWXTUC+tMs5WLYsWzFN3vClZy7qPEklI+po4bVS2hGv2srRujqvBKaO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774195060; c=relaxed/simple; bh=O/0+EEFKC+kJrViTx1hpFrUcUp3ITetgY1I7Ly2ASvo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dJ2czDvFERvApaBHqlSAGiqJL5rnkF/QgcRCASYB/0cRM5DpTgMz4Mcu+6aJlAM3fJQolvE9bl16O6DWydtNdrovXiV5EWL+zKkHWcnizg/hI1Y6uZmekdy6qoOkUGv4yZdvUBXc+q8XFT9klMQoGKF3lB+6DPWNgR9l2WPPjLI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=J4tXJxPI; 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="J4tXJxPI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48B00C2BCB9; Sun, 22 Mar 2026 15:57:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774195060; bh=O/0+EEFKC+kJrViTx1hpFrUcUp3ITetgY1I7Ly2ASvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J4tXJxPIPrgz0CadeeV7+7KT1aMY9uLIhl5HCKpRzpqzSGjW12GXNEuiwIXCSkVdI G+GbWzUPAPKTpVEDQ94rIl5J6EUQR52cqdL0OlkhbkTs2Zj3nphXZkaJ2TOusMXTV9 4TtvRyaufrJ91n3SSgAIAOqgM+68NVJCMhPx4EFexaSQWsKIji6qElSsdmKH7lLrHg xKSQ4MEnOuG8/l4dZ4ItJKs+QbigXNWfx4KnROiF3wXYYOzDcPjsIZDjdzQ8vV5Bam WDF+OecFSRN616EZtOHNjvFI03c1mQgh3Bj5ZufdAV0lgEiSdb083ZfkvhAWiskfeu hg33jb0OmHBLg== From: SeongJae Park To: Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v4 09/10] selftests/damon/sysfs.py: check pause on assert_ctx_committed() Date: Sun, 22 Mar 2026 08:57:23 -0700 Message-ID: <20260322155728.81434-10-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260322155728.81434-1-sj@kernel.org> References: <20260322155728.81434-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 Fri Apr 3 22:31:11 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 C345336AB61; Sun, 22 Mar 2026 15:57:40 +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=1774195060; cv=none; b=dy/LPtm5nxfFt5y+YHg6K2hmLk0urIzGxtiuys6CkTMlHfpPgs9uUN8YCVHcR2AZmlRUuOWMG0eQ+MgCkoZuTnAVQBz+eE6rug6EX85HgTRFaUAqWYY9X+ZWfbxA8A7fthzdzT6VTXPjvInMB1HTZ5vIFkBKUt5Pj9cQ7iE+md8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774195060; c=relaxed/simple; bh=dT0Co/dTQSMuQWLCRwci5Vw0M3Z0t6s+AmNwdu4waoM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Oahyl73N3/Sa57FCDpn4BwDrVCcafcZvb3BothS4eL9X5VFOMl/KpDfKRhSROdEZQ1G8mZ4v9m1V5SIyez5HhzD9+G4s6+RyGFufuu1pthkp/Dv8Yw+8fonGy/6ONO3+trTVE5bF/MQCoacwgt1F1jtkKLQz5bHrkCt9iZujljY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CQRMJZzA; 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="CQRMJZzA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C550C2BCC4; Sun, 22 Mar 2026 15:57:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774195060; bh=dT0Co/dTQSMuQWLCRwci5Vw0M3Z0t6s+AmNwdu4waoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CQRMJZzAgy5OgtrWB6C6XjwLHceTrAXQUqzUppUpdMEfG2oSL//F9gE4sFVPETCwo wN1trbWGzeNMRD5Mw4+ex1fMDCn9SeDSP2Vh49gb3yAtuRmWkM+qZD5BjnuxpseAcB 43n+HtbZDDBSVXWeh3oZEzWCLy58ld0+8hX2ybPAAn47tw1YbPRXHDjPqQO5mBQO81 k9auOr/SF6gKBbjyq55E0y9i8mLUAbN5hLBiWMd7JJmLAuGuoM9/ywtWolInx7yhaK Bq3LB6hl0Dom9/8AFF5KM7i6LVj7bTBBujloM32/UPP56cO/lrv92FE9BtgNt3ukQS 09cuQUksGreAQ== From: SeongJae Park To: Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v4 10/10] selftets/damon/sysfs.py: pause DAMON before dumping status Date: Sun, 22 Mar 2026 08:57:24 -0700 Message-ID: <20260322155728.81434-11-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260322155728.81434-1-sj@kernel.org> References: <20260322155728.81434-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 | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tools/testing/selftests/damon/sysfs.py b/tools/testing/selftes= ts/damon/sysfs.py index e6d34ba05893f..5f00e97f019f4 100755 --- a/tools/testing/selftests/damon/sysfs.py +++ b/tools/testing/selftests/damon/sysfs.py @@ -193,18 +193,55 @@ 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 [] + kdamonds_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 not kd in kdamonds_paused_for_dump: + kdamonds_paused_for_dump.append(kd) + if kd in kdamonds_paused_for_dump: + 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 ctx in ctxs_paused_for_dump: + ctx.pause =3D False + if kd in kdamonds_paused_for_dump: + 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 +339,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