From nobody Tue Apr 7 06:31:30 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 B04C626B77D; Sun, 15 Mar 2026 21:00:23 +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=1773608423; cv=none; b=JLdzhsQJ4TOm4YeGBSyBFJt4b7sYs498LmUUkuDrlg9JkFfeFpEqlHfnbQx0IfGByOvfWh+5syGw6buIMlkDE2ADHiAPXYs8kNlnmU0d7VILZLJVlcI2OtKMJeiWHekB63Y7x8HQ9ug8CUqcHWLsL1VPSvp1Fiy4TTchVH3qmAc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773608423; c=relaxed/simple; bh=2Ts0pyl+UtHEQzIBfWhdhwzgiRHuVs9/Q4ZdnI3FxRA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OfJ7gGxjcKcMeMp5rHqxMHyEYnXDk18hsqAPk+iqzFLpFd3IUlTk/iGBBEgstab05F25Ozcb/qE6fDJKvWhownx0PYLSNUe5980KjJUFIdDD7g9Xq/Z90U/J5FJCENYOZdclE2rp7whi6LxSksPcQKheUz8ver54oZQf+/Ufsrg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Bm6ND14r; 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="Bm6ND14r" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A70CC4AF09; Sun, 15 Mar 2026 21:00:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773608423; bh=2Ts0pyl+UtHEQzIBfWhdhwzgiRHuVs9/Q4ZdnI3FxRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bm6ND14rLgcPbSPnIIoteONEB6bgXcEmZWVRki0Fr3DRoi+IawOvHV/KpB7D5im1z cbvWVc6vKg3+VkJTeIOlnwajo5AswOqle86S3bWlA073eaObXa4QMUVNQ5fldt/v96 0W0usSu8lBcELqlDL4RaPsECX81dLcFoWR5hKupviomobU7nbTco2Aoc2jKMIAkIeR uwJfFBeeX5xR54/K1NGrBxmcT+mlCHoLJKsW+xaBPePBhRr7yNHN70SJfh4P/6WiJe K6MxH1qZ5uM9wol+C08tP22+tI2FekDQhbrD911j3W8Cupkvqf8Bh3M1gRErsiOzVs 70tSmCtxdqfBA== 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 01/10] mm/damon/core: introduce damon_ctx->paused Date: Sun, 15 Mar 2026 14:00:00 -0700 Message-ID: <20260315210012.94846-2-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260315210012.94846-1-sj@kernel.org> References: <20260315210012.94846-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 | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/include/linux/damon.h b/include/linux/damon.h index 3a441fbca170d..421e51eff3bd2 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -811,6 +811,8 @@ struct damon_ctx { * intervals tuning */ unsigned long next_intervals_tune_sis; + /* pause kdamond main loop */ + bool pause; /* for waiting until the execution of the kdamond_fn is started */ struct completion kdamond_started; /* for scheme quotas prioritization */ diff --git a/mm/damon/core.c b/mm/damon/core.c index f9854aedc42d1..1e9f6aa569fd2 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1331,6 +1331,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; @@ -2978,6 +2979,13 @@ static int kdamond_fn(void *data) * kdamond_merge_regions() if possible, to reduce overhead */ kdamond_call(ctx, false); + 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); + } if (!list_empty(&ctx->schemes)) kdamond_apply_schemes(ctx); else --=20 2.47.3 From nobody Tue Apr 7 06:31:30 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 B22BC2F2914; Sun, 15 Mar 2026 21:00:23 +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=1773608423; cv=none; b=iJfSkY19xnVXruerSp3s+IrEQDeOQJTe6JQ14FclJLCUiXUt1mV8nOjs9RVxkLZPl3JYRqblgNvvuBYdHQlhV7G3KC4LyAg64QNPqzLr2ImW2m7IVC3MfWu4MP519s6lzKFtMZfM1E0PmQb1Gtyt8guUfRVjsChD/OQrK3XEKVg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773608423; c=relaxed/simple; bh=RJ+licMFiBy5Dj4RMj3fE1urGObz4KRM5FWga+atVco=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lK4wtwzV7r/XnttknJUOsRsKJrZDkFUJtBjdqwKipxl1NjfFNye6THGInd2b48E077Fq2IMRJnEQyrXbctaY/SspxKBL8Ycps6BreTjpa4UHmwUo/id45Xsp1oRWC9JVCiqg+tkZv6QYnIaovFHUkXVQYj4SKN27AufzxU7oJgM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dYUjacPb; 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="dYUjacPb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 621B9C2BCAF; Sun, 15 Mar 2026 21:00:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773608423; bh=RJ+licMFiBy5Dj4RMj3fE1urGObz4KRM5FWga+atVco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dYUjacPbZZ/tHdeR4OPPRLF5Z2QcyEOaEeTGWM2oJ7nYrOPKap0koFyiotrZXwILb 7u7zHxR1nef6GALCZ/w3zkkdT3KNbwoxicynfl797ksVEQfx0iXlToZZ+qPsIyGdco gem+LalKmO6ZYTqEkMsTm6jLr2mWZSCRG/JR3bQkP0annKIEYSRJeme69wlBp3JJlu 2jxqZ8g/tF2iYzOwuZ3NYZUwtFIaifMZCLKltuvx687FL1ns7SvgBHiuPVycndn4vD /gjuld0e3Pu7zUrKVkN3dci6syDmqkw8vwH2SuaMtDR9jDIO9CqaJ/EHG7T0Lj7jck 3kp5/o67gFw9g== 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 02/10] mm/damon/sysfs: add pause file under context dir Date: Sun, 15 Mar 2026 14:00:01 -0700 Message-ID: <20260315210012.94846-3-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260315210012.94846-1-sj@kernel.org> References: <20260315210012.94846-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 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index 576d1ddd736bf..4cbb8b9aaba3c 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( @@ -1053,6 +1054,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 +1092,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 +1499,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 Tue Apr 7 06:31:30 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 1976D37C0F7; Sun, 15 Mar 2026 21:00:24 +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=1773608424; cv=none; b=arWWxkFbaa1rj7rMJuaHphJ0w6TPRH3W6sM04SgzdoSYcmiW2sVeA6uiM6NVujknKR6Wr5GNMqBBXe09UoLeizo7PUlXx7MUUHVBCCikf2i7IpUxzQ0Qo2RejPPVzoTEvUMAaIC3sFtYlFre0/L29i+oeFcrg1ky1xRGbS8B48Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773608424; c=relaxed/simple; bh=ZFcnqfyAW4BGE18Wt14ay/AwA/gxtaEmh1rLITl8M3A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nfx36alKeNUs7vpxnC4o9Vp9KNO7Uum9ySZ4BifU2v1jXsSjPzo0u7ips2CpsIu+A56A6HJbYPXhzbWHjrfg0EGD/ECbqpMMWeslNEmpsL3c6Z1yaLzBqwEFYzDRTjaaZ0Bc0cez8YIMTu0trQhEnsjih/zkLQRLd89ngks0dVk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TztPq/Xd; 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="TztPq/Xd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 994FCC2BCB0; Sun, 15 Mar 2026 21:00:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773608423; bh=ZFcnqfyAW4BGE18Wt14ay/AwA/gxtaEmh1rLITl8M3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TztPq/XdarWP317/J+QUEhiIvSmkoULqcTmaP7DcnRcmKg1qhTO1AVyUMzPGaBDj1 tbMOTnARI7GPnhOEOdNV5Mb+fZhuYVsAp69dg5RXpR09GNmgcfIVlmoA1NAkc2af+b w58LkdXXf7h9DDs4NbZP6ldKGXv5TLhnRnfMM01y+D7JmZDPOMdT9DysTX4vWxFnfI n46QpEnYCcYS3x5s8ObGh2QVXh9Pvc5pv4U23/1KY/rOLKbJ0Ls7EdqrzQJ6SfV8VU 4XE9c5CNufrkLCw5tgqtLZ1w/gclkzkMzLFuyGR3rBCgdbtITIELa7VJ677RIkIysj U9Cp5X9uMmR2g== 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 03/10] Docs/mm/damon/design: update for context pause/resume feature Date: Sun, 15 Mar 2026 14:00:02 -0700 Message-ID: <20260315210012.94846-4-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260315210012.94846-1-sj@kernel.org> References: <20260315210012.94846-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 dc37402c0fee9..5723ffe8b51be 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 but only online parameters updates +including resume request handling. + +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 Tue Apr 7 06:31:30 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 698B937C11D; Sun, 15 Mar 2026 21:00:24 +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=1773608424; cv=none; b=Cf04aZpWVlM4jmw0gaskDYYKmHoTe++/U4iDQzH8Aq1l8QX8x+CziWawQ9sCScBhOH9OQ1BP0tzqjqUuaU9BanoE0zDRMym6uuV2lB9bCT8cdwiYWskkyqx1bo/WoRxHk8T4VyWhkvYM4IjzXOE2yOg6Rjg/kuSlte3P2bmb0UA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773608424; 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=ZjZV+m4PS7vDnZ+U0Yoj2fGHDIX15RH3Qo3ud4okr952APs6gHFPPw3+wKq2WZGWEUwBjITUdpD0+rnHR4OSN4683P+74TXl5CefEe4i09M3ClTfxCbFE/mQAP7czxUCRKf9VEoiUVi01knghTLJwXT2mJ5lMrx3xKTVM3LRlNU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g4QfJVN4; 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="g4QfJVN4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08C27C4CEF7; Sun, 15 Mar 2026 21:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773608424; bh=O8n0uNGYuU+EcM7S/clzxsj2TzvWbNFjQtjX/Z2/CrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g4QfJVN4HeKCh0McGrK6msBGDauml8c9RrXjZDMP9MJ02VZ/Vkd6E/nqX8YQFmmRW sNgg/Q6Q6a9d22XNJ5n0qmnm34e3mJwfzEAnRG7d2Yvl4fYJSYm3ZdbOBBPOmTA8Gx EsAfRPdmz/7zI0witMyoa6h+TCl8K2T/906M6l+pGX+iVX30oKFHYFTeihHyQVknke I4kMXMpSi/yCDJ63Rj9jPWkp5Ual1IFTyGe0zuLpnusU3ODg7oTEp6v5G00OfjpllR dkZAE6MAUgnXQL9ROXKLNxnlNl41FcqN7nF5Kuzgfi7herb5VV+Q2VJSuWhbjsq4/i d+9ydz+9ubCHw== 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 04/10] Docs/admin-guide/mm/damon/usage: update for pause file Date: Sun, 15 Mar 2026 14:00:03 -0700 Message-ID: <20260315210012.94846-5-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260315210012.94846-1-sj@kernel.org> References: <20260315210012.94846-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 Tue Apr 7 06:31:30 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 AF3AE37C912; Sun, 15 Mar 2026 21:00:24 +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=1773608424; cv=none; b=huQgaqQM05ntxMB+gVkcyWddxigwIRgLyRdnW1HYaVWjqlyWEUpzUQ5tUENC9oq1MVhyj0tlP2Zmv6AxfY1VAsZf5rWR0yUtFdVHrt/YQqNG7lDE0Tut6U9NfqGpe0f8MDtEmQ6bWCIPEyfz/mrzhgYoxJH0g3SiIen1yD7kyPA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773608424; c=relaxed/simple; bh=acrZio7SwTIWWe0wc5YY1SpE9hMTqgCgT01pPcG9A6s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=njTT4kYlzYw6KPwpl/w/bzoC28fZpZRMz9FFiAHp5I+FpI0babbUARxqKQ/R6l09gGB+EtxJcZ6qDF27vAWoAI8cvikno77u9pPVXAmgKofU/l7G/VmA0qW/S06PoLciBXh6Mb9WBHdJUkP6V1XtdZOQ9F4qYOuvLJsD6U07MKQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PEzKpWx+; 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="PEzKpWx+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A99EC2BCB1; Sun, 15 Mar 2026 21:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773608424; bh=acrZio7SwTIWWe0wc5YY1SpE9hMTqgCgT01pPcG9A6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PEzKpWx+0qOPhCqTs6Tmujac6Z1+jtupZdJO1eipchDkTNY+FsLgjYSiesZhbPdQA 0XI5hq5goiqMBqEYDk5NF+MNK5070vyCbw5UTYRvfPfl4cAeh7+PL2dMdy4zOe4stB BMmRVa6UA/xcNFBFHZ/DSAEbpxZZooS/xb2TInqKQF2o8e8QKulRbIDHlwYlwGkYkp GKLJdWXHIam9TV6vwwI55dqA/zxZrugc89uQ1kSd+2r1JZduUFzX2r6Gf03bSRVF+N 7Km61cD1WWFSCvH8YmzK74Bcq3PGuV7VruLuJOM8NDa2Q/sdg3cE0zGgE2spihnrTb 8SQMDfYmVCX4Q== From: SeongJae Park To: Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH 05/10] Docs/ABI/damon: update for pause sysfs file Date: Sun, 15 Mar 2026 14:00:04 -0700 Message-ID: <20260315210012.94846-6-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260315210012.94846-1-sj@kernel.org> References: <20260315210012.94846-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 Tue Apr 7 06:31:30 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 E01FC37C91E; Sun, 15 Mar 2026 21:00:24 +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=1773608425; cv=none; b=W7fy0zmH+NPlAePQmLwWEpm9rHFJ8LeA5KUn3cWWV/KwGGMvm8b+IFEqjzCcgZw9p7xHBNevQ9dKpyW8PR4xWjY3XZZJiD3FI6ym2fn1S/dCh4tN9aDWGYojvtQRIpOTpCaUIggkWuSrVkNglmMnC/Qkie9Yle3KHJp+cpMfTPk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773608425; c=relaxed/simple; bh=K+t0IBDIG7HXVVaXmRTS++wFYmoNTkKzAJmGYrkNPTI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b29lRpXzYB4FoyesQcUS1jdhR1eevlxHmWCiLSZcihUf6KKlK7QAo8BOQdANrBuIKmRFrH6eyeIe7ZGIAvTH0NCsPIlH4FRYjCWyyuCDAs8CIiQDwAUEeS9NfZTUIe2T1DYJJVbStXtd56nw5CjYJQcNeIay/E2xKxz/TLliqiQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mv9sn8r3; 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="mv9sn8r3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B2CEC2BC9E; Sun, 15 Mar 2026 21:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773608424; bh=K+t0IBDIG7HXVVaXmRTS++wFYmoNTkKzAJmGYrkNPTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mv9sn8r3K6vky9qU7ER4NsTzi7rEvDXGZEa6QWEd4OKBB1TTtjpYCawkrwKSAuv8/ p61zmi1755sjHSRP8epCQfX4zq/4TWiLEdK3ufEZrAyA+Ktr8HCquMI0ia3AIApZd0 mqZ/42zV0zSCVAIh9K3NrBn6DsW91ZNzkKhmiVSMYVFXp2KTZvtLgvl/pCrnrPVGRI 7o2OuvjsXG1x9s0TJyvlosUrJMn/+6Bx40388X+JQvmP2jkRcvAwLTOyRwU/GDP6w7 SyeB8jGkZdtCIUQCNAnuVwoo6/bRIIZo97YZU6UFESzzBfIkWenOe5Qa6Yccz8JUiz rW7O7QFJSZ6TQ== 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 06/10] mm/damon/tests/core-kunit: test pause commitment Date: Sun, 15 Mar 2026 14:00:05 -0700 Message-ID: <20260315210012.94846-7-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260315210012.94846-1-sj@kernel.org> References: <20260315210012.94846-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 Tue Apr 7 06:31:30 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 3133337C935; Sun, 15 Mar 2026 21:00:25 +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=1773608425; cv=none; b=uHOE/YGRfnmcLiHBnSgw3CoNYgFBBeIxzmsHcNnY1umsNS65AGkTo3Xd0mk0RIoUSQp+aO6hXf9rJ/GOFxIKGY55OyGLVGHF6a0kGxDSwTByI6HdUzN+WFUkgaXoEOqEYh2aIY1M5M4rvuaG5nFB4VpsDHdQ93O5WW9FmdeUFtE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773608425; c=relaxed/simple; bh=TJXeffpmshBn5e3s77gk9ewA/YmV5afqYkZ0L4RsmNM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sBCIBdIS5YtKQBcxVa9EeEjSuVPjcqEMzTktoeLrEAKOTip5ymjILHy7jnmXyXme6nMlRQi201wLO3qjwIeFKaWIj+QBFtnQ5TIlXiZujDAtfHq7fm12V4uz4Fu62NeDeFCeDGkx0qgTompZszKF/6Uw5z8oEcd1hOEM+LD+ljA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XYTN4IFR; 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="XYTN4IFR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0699C4AF09; Sun, 15 Mar 2026 21:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773608425; bh=TJXeffpmshBn5e3s77gk9ewA/YmV5afqYkZ0L4RsmNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XYTN4IFRaRp+sesyBx8wFBO0MD+H2iyBHeaY5dDSP6FDhKvuHXHrcIDjBS4EDdrzV Ft+7xIeOrtAAg0/ch/Qv/rZIr91vvxCynNYUsZp5K1iBP9MJi0PG681M9kKl3Bs/Kd nJnEaSlgkmaxMyQ+lwGsMJ1hqFtOi/KCml7i6xRkyZvt2iTqbk9NhEMXhD83oeYIt8 2gZCsC0bXBZs3KHDfvBcTSAhsvM5Ac/TQ+WNMyqiEvXn4RwG26DoE/4sKWqF8OHxUu 3xjeOznxucWkfXN2/FzB8we6ipAiJ9YK8DxiHoOuHmZXfyOC8vWQ1vgnSWp+K7I6UX Nm+pnZnWyq1FA== 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 07/10] selftests/damon/_damon_sysfs: support pause file staging Date: Sun, 15 Mar 2026 14:00:06 -0700 Message-ID: <20260315210012.94846-8-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260315210012.94846-1-sj@kernel.org> References: <20260315210012.94846-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 Tue Apr 7 06:31:30 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 5DBD137CD24; Sun, 15 Mar 2026 21:00:25 +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=1773608425; cv=none; b=m6DzMw/ALodoSf46W6au3jGOfdZB8rizVtQPc/GATJtesXrAhnZ4JeosaCQhNWQ0ZfKs85WPaTjpe3mAkieYj9zS4CCwQTftm908k8e1Eizk9/8wDyyjH3zup0RJWiSsBSbQ3Du8GdaEhB2uPcHfYiLb2iljxLPqHDWCdJ0icwM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773608425; c=relaxed/simple; bh=9O26QoN+V9tNeSexEgjKx5Rwm+ySmwIIy3Pdsz7ovf4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l2+allYcw+mR8NsdeNSSZqlBEqihjQw0zWdGIcl9jKt43khU5hCAxz7iOyOSjUE42ciGi73Ek9Hays+6lnQu5GjDFHXjQPDrsMt+ZXXQlx5rLbX9ICwHds6yeWHYiQQi2cRIj0KD86rccGZH3UpqwZaMOLB8bdd4qxklqmMeKUc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qUlz3+NL; 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="qUlz3+NL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 257DFC2BCB1; Sun, 15 Mar 2026 21:00:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773608425; bh=9O26QoN+V9tNeSexEgjKx5Rwm+ySmwIIy3Pdsz7ovf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qUlz3+NLoFBBpOsHIh6MDDQy19Hxiwz8wOt7dLdhWqaQCiikMxlD9OhxHjxS+Gs1w PEOa+P7iPWs0SpcbyiqYnyHGrLBvQwZXo4bOo93kb4KyVHLu6icQKdw1d5ewR1qj+o MQLdHjCw0+g1R+dvoARJ6mAdJ6oxuRiFf1a08wcrZnLU/yb62DRWBkyjyYSb4fYOiq 1o+kItvFI8bZfB8jryOYEgHkzJ1pdrPSqO65Vm+ogCIIT+Jggke9YAiTFFLrOgUU+6 IRhkYDneji1tfa/bWsZ2p2J/CAmbw5s+50+t3zZkg8SVMCfRs0Lx4A1l22Gu0iCBy/ IEDcsYgcTa9Yg== 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 08/10] selftests/damon/drgn_dump_damon_status: dump pause Date: Sun, 15 Mar 2026 14:00:07 -0700 Message-ID: <20260315210012.94846-9-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260315210012.94846-1-sj@kernel.org> References: <20260315210012.94846-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 Tue Apr 7 06:31:30 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 97B4626A0C7; Sun, 15 Mar 2026 21:00:25 +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=1773608425; cv=none; b=Ev+Ap1L3i4OraIPR3lLO4QV5/EJabrnIr/Qkef+QfaQcTWgdg5k6OsjCNySHiTHDeI+3UfYDvtW3JKeGnl/mbW3P4yapi/QO3rTv9pffvAsw/4vma/IdHs8yhr/RG77GcZQTHtSB1kB5ciD0Ftk7shfjtqJ0rH1JuToI1aZoxSg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773608425; c=relaxed/simple; bh=O/0+EEFKC+kJrViTx1hpFrUcUp3ITetgY1I7Ly2ASvo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uAxGGbZ/C7eZRnG94K4CE5m1+LD/SHcOuMHYnOH3/5sD73T1ylOwaaclo7SMKWXyb+K8XBl+4dxli2N2rfrlNn+sIMBVJrjdGwu5/KTh7XOzYRBFf5WjLA+mcObZqsPKmC/OoHas5bv/hZNQIbvXyC67bLSnUWNbF3QiFcfmwn8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=H4UCZ0nv; 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="H4UCZ0nv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FEF3C4CEF7; Sun, 15 Mar 2026 21:00:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773608425; bh=O/0+EEFKC+kJrViTx1hpFrUcUp3ITetgY1I7Ly2ASvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H4UCZ0nv3gBgH8YiNIiRnB2qR3Ee9C8eNMYwibb6/8blLcIw3t8PCOrL9Isdi/2R9 rb8aByVgzVs2R5FADMzd1/m6NkxE4rfrP7s3fYiEWCmKsDEffQHiMDBJFomoxcZ8Y5 RZrMYxOensQkz8KytCvJtzwsRSLG+7JVnTeT4kLPkC28tGtjgkzcEgyzJl4yvSW9L3 o3uLy8DdNvD9TLyv2ovNm1oVLKMsmJLIApQZyrBCu9TylUd178/K5wlY6jfbrL2owW SG85E/IEF5217827ZHWe/33YVaXNKpvwKOjiPgH2HJoWw417Kq0jYQDaCh1cEWP8vr W1UfcZPSE4eww== 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 09/10] selftests/damon/sysfs.py: check pause on assert_ctx_committed() Date: Sun, 15 Mar 2026 14:00:08 -0700 Message-ID: <20260315210012.94846-10-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260315210012.94846-1-sj@kernel.org> References: <20260315210012.94846-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 Tue Apr 7 06:31:30 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 DBA7037CD51; Sun, 15 Mar 2026 21:00:25 +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=1773608425; cv=none; b=SddqhcC1o7p4OzGJfmWGjkf81KHJji+rBVLBqXBz6Vvd9q5hnnlKeDfZjhTuS1zL6sJcTgzvbkmo6Kv3ETxcHzB1y2VSn9PStLYDsSW//mbelqXbrWARTPvZfE9Ua9Sal/4ZJXYhN08idm/JMeGo8Bl0jbuwXMhOP4wBBBqTDS0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773608425; c=relaxed/simple; bh=FkncVS2Azn3cp8UsK6No3qAma6g06Iasldq/cgtIdxo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SveRXRg2xVD8iX2Xm/iOrL9P+ybgHGk7BGSo6hz+5w/rGNgd3ZFjKCcM1wixpxneNX+HEnbS9/7EGS9hITMIoREVCsJ4N6v5idkRzwGJzg77EvFjsWsunj9lysB3c/dfmVQf+cb0lytfYyfm2Ijx5+qUGehn/nkr9ITOjVLivKI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=u0QI5i7o; 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="u0QI5i7o" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CB63C19421; Sun, 15 Mar 2026 21:00:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773608425; bh=FkncVS2Azn3cp8UsK6No3qAma6g06Iasldq/cgtIdxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u0QI5i7okhqAuIuYc+m4ZHOfluiK16mEvCAMEVk6y7bf9Et5R2oufxpLOHO3aH2C4 7CQlyof6w4qpYd6u1hStj6eOvzYvr0cFTsCPW8D5kILIhpYIwEibhBe2hSgy+L3S5J 1rlnJ6FhBdfkOfXs9oCyElr8Bb6PMBWXY3LkKnNUd3MFJcYMyIowX116pfPT0NxtMT arbLxE99eeSc6KS1aRrPmeUhZBcGATb/peeCxZA8nRFqCLBM+8qwta9JD9ooPhgzeH JYg6jrr2wA7XD7biLr21QIft+Ew62TmVBmlDUlTa2K/0GhaOir9uDmue40n5Kz6h3J E2pSmsHnzVYtw== 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 10/10] selftets/damon/sysfs.py: pause DAMON before dumping status Date: Sun, 15 Mar 2026 14:00:09 -0700 Message-ID: <20260315210012.94846-11-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260315210012.94846-1-sj@kernel.org> References: <20260315210012.94846-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 | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tools/testing/selftests/damon/sysfs.py b/tools/testing/selftes= ts/damon/sysfs.py index e6d34ba05893f..a1a29f1a7c27b 100755 --- a/tools/testing/selftests/damon/sysfs.py +++ b/tools/testing/selftests/damon/sysfs.py @@ -193,18 +193,44 @@ def assert_ctx_committed(ctx, dump): assert_true(dump['pause'] =3D=3D ctx.pause, 'pause', dump) =20 def assert_ctxs_committed(kdamonds): + paused_for_dump =3D False + if kdamonds.kdamonds[0].contexts[0].pause is False: + kdamonds.kdamonds[0].contexts[0].pause =3D True + err =3D kdamonds.kdamonds[0].commit() + if err is not None: + print('pause fail (%s)' % err) + kdamonds.stop() + exit(1) + paused_for_dump =3D True + status, err =3D dump_damon_status_dict(kdamonds.kdamonds[0].pid) if err is not None: print(err) kdamonds.stop() exit(1) =20 + if paused_for_dump: + # resume + kdamonds.kdamonds[0].contexts[0].pause =3D False + err =3D kdamonds.kdamonds[0].commit() + if err is not None: + print('resume fail (%s)' % err) + kdamonds.stop() + exit(1) + + # restore for comparison + kdamonds.kdamonds[0].contexts[0].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 + if paused_for_dump: + # restore for the caller + kdamonds.kdamonds[0].contexts[0].pause =3D False + def main(): kdamonds =3D _damon_sysfs.Kdamonds( [_damon_sysfs.Kdamond( @@ -302,6 +328,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