From nobody Fri Apr 3 17:32:21 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 E7778381AE2; Mon, 23 Mar 2026 23:15:42 +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=1774307743; cv=none; b=Tvu051IIHPyezemRHgpY552YThN4o9umq+cHu1DT1eypL7c8gVjQgkQ270/zgvYDj6eNyEaH3kIVZkYcVtDft653aLCgQNaWk7X9XEoQenig+L+NPw7uQDWwlgPfsZBTERff7iYEKC17pevqyBbqyM16nWzVMSGWUPkNBPxfHJg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774307743; c=relaxed/simple; bh=R+OyX+2+xXzYOPMk7hH5cT/Fo0kVRBRvE8hVSDn6Zoc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JzXLA3e/EcYTiAKWqPYq+kfCLiQ1W2f+hM/oGXjtX06ifqTu36rgKppDHEwBRMYngjrKnFUsn048hcfaUs1U5P0fPH9o+bT34ziVfTqOOktz22VMplGsmdQ/hLDhQD+aGut75D65u5YqhcGj0xSbAVC9D1jjlBXNo/adY7eVouE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=cCv48XIw; 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="cCv48XIw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3770C2BCB4; Mon, 23 Mar 2026 23:15:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774307742; bh=R+OyX+2+xXzYOPMk7hH5cT/Fo0kVRBRvE8hVSDn6Zoc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cCv48XIwG2VlpoTnqISMydw2TQW4JBJcbUbw+yjZ4YTzn8104rOdhJHZhNTAcj1+q j/LiMTkFRVcSeEv9EdxiNdCUTQmpJgxxWHyz26hkzY+ZeoEd0IqBp7ddKtGuW5N4tS BhHlj69mZp0t/YaRMHikJFeUTcMBSTjBhNl6eJlYtafVwas4ARPOr7E0ghwUjlW7Mc QREBRETQAe2S92uvisW9m7M2RFUoEIqBYOj0AnVb92NRZ7yx6I6fTPlIf+4f1oARIX 8v7sU19F9gup3RsNgg3LFT4Zylaq+ztdvOxKFqyyBCdeaJrKMZwfcNgnLUWs9alNoB +4QCmXgXaNEcA== 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 v5 01/10] mm/damon/core: introduce damon_ctx->paused Date: Mon, 23 Mar 2026 16:15:26 -0700 Message-ID: <20260323231538.84452-2-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260323231538.84452-1-sj@kernel.org> References: <20260323231538.84452-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 04c8a052fcfbe..65c8d5ef510fe 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 17:32:21 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 3B3423845A7; Mon, 23 Mar 2026 23:15:43 +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=1774307743; cv=none; b=Q4pJdnjWl8WwS8IG/7LQ2jjwZZ1ZTyavCs6QHpmIdk9OBvxBU/dTaP5LzQctkWHjwLwwnViFhjM2mm5aasMnCA4Zm6CQqs6l0nnFVBZdDmlX0VWf41sjh/dMwENMewKw90KZ79UyhrrmmEiAsbvJ4hGgfwMphdJEjoKjBdhxQYA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774307743; c=relaxed/simple; bh=4uaA+eem3fKB2uPWGLGeH18mf1wXB30aEUf0eMGJT00=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ptNZNzOmHsXY0wLOxw/lNgevFcO4VYRM/o3GagRGWEhTIaWcn9w1IRkRpVZJ0jyxSw92NggdjzeV6mY0ZKnE0inHSRkKZP7hQ2AB63IhS6UmbN6n9kJ45zdirVGesGBVAwMiuX0I5rx5KNa1IvodFwRVkgecsKo3Ghcer2zJqNI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=n2jOlGxK; 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="n2jOlGxK" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4FB6C2BCB6; Mon, 23 Mar 2026 23:15:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774307743; bh=4uaA+eem3fKB2uPWGLGeH18mf1wXB30aEUf0eMGJT00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n2jOlGxKZnItSh90/CHwHf/3n40YsKYeI9L/w7x5ASEzPnbBBSCpFKdwahiYgoVeO xvqprGtmJD4jplV0wQSYLyL7jEFiGAvX8V832u8sVPSvnARMhUY023Nu/ls/MHlPZf dt4o6t9+fTL4hXy1fm0pSNWIimu6iRrL79/YtqdWxViOExCq40k5Yt/kUwc9hLVdeC WiuxaHWn5HQ3iING4xC5x89Wn7jnK53PZPg6OmGpq9BXywTInLRjTFCo7g0jNApELO YA2mGnLf6Z1SuTzWoFU3/3If7etKf/7aHS4Kz1mTUfC8QtH0lGuEe3Uce4AmcvT3f6 joe+9vz2UYS4Q== 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 v5 02/10] mm/damon/sysfs: add pause file under context dir Date: Mon, 23 Mar 2026 16:15:27 -0700 Message-ID: <20260323231538.84452-3-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260323231538.84452-1-sj@kernel.org> References: <20260323231538.84452-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 17:32:21 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 963F83845C0; Mon, 23 Mar 2026 23:15:43 +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=1774307743; cv=none; b=SN8D4KVbxS7sza2azN9H3ABICSq+1vweSiF0polIpy6wVFGKtbv/4qsyLMhDqXs82pnjsekkABr087sCU6YHfvvI2VOtBg+Ceef3mhSXiN7FFVCfCLXPq6XpXj1PuILhaGiqGDKodajj1rNRrAMKze0ZERBow5moze+HU7jVUys= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774307743; c=relaxed/simple; bh=qt20gza/ZGfZPnGlsbY2CkGg3eBlVlFouLw/z7b3qI8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e2fGBEwrKEIgRtJ5F/2ufmsYmmcwxA31akkYG+DFwUoUJcHcdW4usUvYhlOWKLf+5UrHBWrIcoBNKgsiYiyrAVdL/D83q3qxSoLjUYHrkJY2IMjStP2iDkjmZjlOTnAo/WddHJABURrOa1oqvI4fzMpwnwaSJVp7fB8d4bdnRQI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jtcnUefe; 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="jtcnUefe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2382BC2BCB0; Mon, 23 Mar 2026 23:15:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774307743; bh=qt20gza/ZGfZPnGlsbY2CkGg3eBlVlFouLw/z7b3qI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jtcnUefe5isd+iu1bOQ8wFtyEdgurzuxLAhYdpRs7TdAXyBqAPivTn0clXdqmucRZ MvbCxhKza0TRTEGnE7WI+M0r72G7TTpQEsbRPOuUYNaNvekbEm2SBySi/GxC2hFOyV pMinKZjeUOem+ULSSRrIbEYe8FFhQbnHbfmCdAd3QolLxeiRU0j4AJ2H0DWIAoD6+S OcSsllTbBXwd44+SacwVNMwNBKmVhX3f3U9/JZKSrJdYJY669gXsTBMbno9kgOC3xm 3sksolXHcg79ASGnhVk6ONDh8394Vn/Rkcn5klWaZVnDBfI8DsysfRoFAlD81bys8p oSQllZsjRUh/Q== 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 v5 03/10] Docs/mm/damon/design: update for context pause/resume feature Date: Mon, 23 Mar 2026 16:15:28 -0700 Message-ID: <20260323231538.84452-4-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260323231538.84452-1-sj@kernel.org> References: <20260323231538.84452-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 17:32:21 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 E33723845DA; Mon, 23 Mar 2026 23:15:43 +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=1774307744; cv=none; b=Ae4gPUSci3HXFUf7+Q1PUl8vd/+ttrc1n7WFd0lM/NVDxcZfTNEdkqpLq1ikXiNUKYvcs/lW4HLg+h+yF0E/6jQWb5KhpSqsAzENaUakhGLrTa8Z9BAO/FghZ2D2Pqmm2NMilWbRJsPPQ/ofKMNHfJ69WJdgRnZy3TeOYCVbmQ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774307744; 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=NGiJaqFw+E3lBe3eHwnWgZ30hmTWKY/3kRFOZPikqXXwiVCLvtjeeQjUGlHw5AiikwacutldqpUl1E9MnICEbk6WxyySe8dWbOiqA6b4kFtv7FxJP2l9RG3lm9H5i/YXqI7KfwdD1rwhtSvLU5gP5bZ8CSYiMa6mg71aoy1Q7LE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nA2KuA96; 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="nA2KuA96" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82478C2BCB1; Mon, 23 Mar 2026 23:15:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774307743; bh=O8n0uNGYuU+EcM7S/clzxsj2TzvWbNFjQtjX/Z2/CrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nA2KuA96J94NIVA2IAWwHQY1pV5olXSCsVBQtnd3ASc3fu/I9TZN4Nh8tt8Hd5Wl/ /z/JHKQzPcqbLE+RdgtksRWES7360W7qmfC1u8UD2U7mhzoihsY5ZT8S9wu9VCpdg1 HIP7C54R+Q1D6UmP1jPH/3/GRhnu7MnNqCiaaeMKCnb0cujKqnyWwLM4de4gTyFqSq n2zGC1LGWSx/MV+LAVHxEzIDRF9LYLHPNf5aepIxW/F7AcZJZHJkx4P0MudnvN5OAU ERvntDgA2bZ2iCYwv82Fci5x13zhNnANmwSNyElCFmWH8OXl75jIZcEnXv3l2IIlyN 8ZXHhi+u8RaMA== 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 v5 04/10] Docs/admin-guide/mm/damon/usage: update for pause file Date: Mon, 23 Mar 2026 16:15:29 -0700 Message-ID: <20260323231538.84452-5-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260323231538.84452-1-sj@kernel.org> References: <20260323231538.84452-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 17:32:21 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 2B37A3859CE; Mon, 23 Mar 2026 23:15:44 +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=1774307744; cv=none; b=IX5KUDRX/oVtgaJGLDBrewENr7lO2QvFT1Xhd8O2ZXydNuq6mrdcwpcOBP6ki3+sijZy4ROaoIQZmh/A/hVPpPfc/uX0qJH3CGU4ci+32azMyEdt2WJuaPC7Zv7HDQoqkyHxb6hP0QT4BU1Bd6tarqN9vF0Vqx/k1Lr3iLgrMec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774307744; c=relaxed/simple; bh=acrZio7SwTIWWe0wc5YY1SpE9hMTqgCgT01pPcG9A6s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LRmPsYAcrikf4t51vDz8Tk9bK24hqd9IG/ivPK5XoikwI0UGWrMAf3e+ZP2vQtJ6naHv77SXzBM26EbTjvxmmmlRhEk8pfsdLilJSVHclt+ruNypZ4ckarzP1x93CFhFh3VPkH9slJ0i7dxzcpmHRXf/Z1i4agrXbexOghB445k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VnSjFPvf; 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="VnSjFPvf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E003CC2BCB5; Mon, 23 Mar 2026 23:15:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774307744; bh=acrZio7SwTIWWe0wc5YY1SpE9hMTqgCgT01pPcG9A6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VnSjFPvfAcvUf0/tfHq8Sc/28cxKBdedQrh8rBtsF+MA5bsuetvpBvO0qwRRvuycd DdMT43ydffE7qwBl9caifEwjpI1i+5eKrjccPXHPG5H4N8RIbCLK0SbinAkSyov+Fb 851T063Zdho2vvyMHk52YbLCSfdJY026nE38oGZXYNRc66WWUp/PlwxIVH+AZfdiV/ mCrLfmUImz9LAGecK4HeuM+u8ce3fkoEV4g6VE4YKoSwrRu6AAbIEHjOFzI05BpyWl ewFCo0N0HlqE6/nS9MF6uSXGeUl59sf4OqkiXfaGsBK04VydE6WHq7i18dKnXTj4Tx xGVPwnUDrkZ4Q== From: SeongJae Park To: Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v5 05/10] Docs/ABI/damon: update for pause sysfs file Date: Mon, 23 Mar 2026 16:15:30 -0700 Message-ID: <20260323231538.84452-6-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260323231538.84452-1-sj@kernel.org> References: <20260323231538.84452-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 17:32:21 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 7473D386458; Mon, 23 Mar 2026 23:15:44 +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=1774307744; cv=none; b=CgFJOx8lex+XnpMuN+1OjrmtHLMw59yD0royTRUPkkvFzUMmyNuDOVuzVuUxw8pi0HPlql5r2iy1zSPGYL0G8BMIc4RrqHkALnRE2Ts+9JJiYvnOFN0OhLqZG+md94+SqyqaC65mRJErNgPvffMfj/0U9SWbwqa/N7YQAze8yR4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774307744; c=relaxed/simple; bh=K+t0IBDIG7HXVVaXmRTS++wFYmoNTkKzAJmGYrkNPTI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CiU3jKRhBOMAS07Y18B1BeeHxTTovp0zuvyWOdYJHVvqw2fpILwurqmE0fxxqDL2Fwep3GqZoFKGQaJ0IRVxrHQRVYjfzDVNso3tkHTsNfDuKRUv8mS4PhhCPnXIZU++VevY4X6YaidVY4pFYYA5lD00x4u8h5f4opoOk0oIQRk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ng1A37Hw; 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="Ng1A37Hw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1ABB4C2BCC6; Mon, 23 Mar 2026 23:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774307744; bh=K+t0IBDIG7HXVVaXmRTS++wFYmoNTkKzAJmGYrkNPTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ng1A37Hw6bMYCKJXyLwyQeLILYH5OKdhZtWcrCtlsYIRiJ7U2bKjT9GeIwk66n4XQ of51gtUsdXBfQxFf6V2zKTjgXeht8N/2fnGithcDYPZspea1z3sXPnMnXpm8Q1HP9U VfrZES1lXNQ2uaJtJPkAQ5THrItnE55+2xHp5RSBiUfIoHMIQcqwUY2hEzRztbjgof 9d+/tP9qMPZObt65NZeT02xfRCnX6MDqkT3Fq3eUrYp83aGNFktHY13g1CouT/7g2K 0F7F2bWfnnIz9KCg8sMuQwarbq+XVeU6hzTwFwT36Vh7Gf0YBtCcDrWhOHqzwaZTdQ QA35PR9uRBEbg== 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 v5 06/10] mm/damon/tests/core-kunit: test pause commitment Date: Mon, 23 Mar 2026 16:15:31 -0700 Message-ID: <20260323231538.84452-7-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260323231538.84452-1-sj@kernel.org> References: <20260323231538.84452-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 17:32:21 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 98846384228; Mon, 23 Mar 2026 23:15:44 +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=1774307744; cv=none; b=bP6M24jBC59DPOLiQYdaQyrHcCs2d5DfjwWcUZQ/C9V9+ffw0W4macbA1X33Z4b3dv1ARwsM/ST377XV/nBqLmOCzeiDJgg6TKuOBLxsVl2YgS2+ZQ+/3y4kOQ5Dh/krPV67VNNzccnwAJND6wRcGI4qWrqT6eGpopSUAIHulIE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774307744; c=relaxed/simple; bh=TJXeffpmshBn5e3s77gk9ewA/YmV5afqYkZ0L4RsmNM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZRAf9FthoR3dZmX+HfBeV4IJaGr2WAbTEGHjWv1oHdPuuPF92B5G92PlFjf2CKdD4ZWVNSHyn+kUIbLuoDX6VnchvHm/EC6bLGOotop/SdpBeeVnspGM9gr/ytGY4MRYazmEDeioG7pSx0DGy0KSGsf7jE0pzSgM1kcIoWYlPWI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eNqinUsu; 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="eNqinUsu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 604B4C2BCB5; Mon, 23 Mar 2026 23:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774307744; bh=TJXeffpmshBn5e3s77gk9ewA/YmV5afqYkZ0L4RsmNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eNqinUsuiogjYHI1OaDQYljy/pynstj5DRWXkS8+qVtB9giaSeRU+M//H5Er5vicG +B+hvUro+CkWmFCRcuJVzzZ+qt9qNrFiOmeHTop4Lvyq98qTOxNIx0ZWlO77e599EH 1dhUGMO/zMT8e+kZ5gGnByxZehl/W7zNOfgr6GcgQHSbJZmDTcheu9ncJgyCyURNST yDf1zQJHFdIg9QWami6JphQlBr+gpWDsgxWS0L9oaRU1TmPPf6qfqKWyiiT2PC7ocM RqwWgk6YC1fFh6MKUMa6dYJsRjxrgf5EmS6AfYMKH2Yeay3Jsi1UYqH+XK8BVBNDgl T4AjfArJH4zDQ== 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 v5 07/10] selftests/damon/_damon_sysfs: support pause file staging Date: Mon, 23 Mar 2026 16:15:32 -0700 Message-ID: <20260323231538.84452-8-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260323231538.84452-1-sj@kernel.org> References: <20260323231538.84452-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 17:32:21 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 CC192382369; Mon, 23 Mar 2026 23:15:44 +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=1774307744; cv=none; b=s0FvChXf5GMumEYstITZ29BB3A2FBGSGI0rPvKvHd80USRUG2GFPZFprVc2NYGAXJQBp6ekd3LUkhhUptmLrOiPuFCxILbLMRKUsy7XURngvgLTP2Kh5xVjOjG+cSY4as7VJFW8R3SKHZKZzjZaHc67uvmMqTJkLpAo9jCzh0Xg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774307744; c=relaxed/simple; bh=9O26QoN+V9tNeSexEgjKx5Rwm+ySmwIIy3Pdsz7ovf4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z+zpK+z4Ftu+1ndkQCsa95eHc6kBCXGaV0czZhiQCoZFJyCX5K1jWGoVfJvFK3qzVSJnzqnPnvfs2RMUhXQopQanFHiJiMcftDHrF7ZwudRUOhb9nzx2HaJBtpRxrsFxmgvJK2RaiKPlKgBRqOhn7HlYFQaTxGwsy+SSI8CNLOk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NQ3wtS4V; 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="NQ3wtS4V" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98B5FC4CEF7; Mon, 23 Mar 2026 23:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774307744; bh=9O26QoN+V9tNeSexEgjKx5Rwm+ySmwIIy3Pdsz7ovf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NQ3wtS4VHYPZf66jO1csQvp/LpE0Ybl8w5Hd466GHvql3tGqyF+A5aWR7fuXZgxQ1 ThbRkyMmVCeDuYOQzSJynT4T1Dk49A2ePSevU4ezpCk79vD3QjdVPbIMLoskqDibj6 15pxS4BxUZ22m77hfPXgBUV/ySrdFqNNAobvLzbmCeAzYA60umafO8Bx2Rt0Z5batU gL8YysbsUrtKBJszNQ4AZMbR8fYelrEXd5LOnA+M1yx8AiAwQ5UvVQ71iyVDi0pVXr yP5/R3F0jzixczBsV2atHVSqka9fnMCY59M3xMVdRobs6otmCQUlwQxBV7IpDAdQcb R8bAJGnnI1HXg== 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 v5 08/10] selftests/damon/drgn_dump_damon_status: dump pause Date: Mon, 23 Mar 2026 16:15:33 -0700 Message-ID: <20260323231538.84452-9-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260323231538.84452-1-sj@kernel.org> References: <20260323231538.84452-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 17:32:21 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 217543845B4; Mon, 23 Mar 2026 23:15:45 +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=1774307745; cv=none; b=gRBGCUjY7J9OqTeohzy6Du86dJ/oCcCDFXwax9DzQzhgiGhH094NPx0lz71uccTb6wOwas1NgBz1XSS9/U3FMz1EK/srISpAuglToBGwocDK0UGC9R7L1nAboZPwICx1Ttx04htva9sIgibLGSMm1YCmB+1J1ZfRL0ujj0IpDKY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774307745; c=relaxed/simple; bh=O/0+EEFKC+kJrViTx1hpFrUcUp3ITetgY1I7Ly2ASvo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=m3RoMsIoj1zVvYOsUJyEG6YifJHkL8zcVmUwib4kfcbOmPMG2sz63swGod7n8zJCkjsZBlaGqESvgc0M9MJzuvM/lL5SxfPPy6u06nluV48T7uc6+kmgLicNEC7lBccUlwQWENmvBnCDXUMdDQjJrkJhy3TsFHtdNWVBWll79cw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NPKMVkDO; 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="NPKMVkDO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF53BC2BCC4; Mon, 23 Mar 2026 23:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774307744; bh=O/0+EEFKC+kJrViTx1hpFrUcUp3ITetgY1I7Ly2ASvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NPKMVkDOLtco3B7ZLPWAa2M8E1Ji3gZ2aXUcvMFntuLnLoYLD8/IJ/KasrOEe1jVU Zva7aSnjH4FY3VCXaA5PM/39iceh62guADzcpUrE7xkQa5ziIHHv1E90uONN2BVvhK SEu2mFYHCYtNmGOZrPWf3UARAkKM81Bk1wpM8D2Q+yLE8/aRvvlmzw6qxePYZtGKXR jyb9DKLk2vk1Bo7rHriQ6pZNjaldjP3Jmyu6j9nTLVSdB5gR+Yd3x+1nAPpfCUPPGB 3h9AIKo3zyzqRlyu3J5l0pmodG/xArbIuEd7T9IQoi0tgD6Tsb9xm6O3MDZwzmAgGQ 2U5cqTpz6dc0w== 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 v5 09/10] selftests/damon/sysfs.py: check pause on assert_ctx_committed() Date: Mon, 23 Mar 2026 16:15:34 -0700 Message-ID: <20260323231538.84452-10-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260323231538.84452-1-sj@kernel.org> References: <20260323231538.84452-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 17:32:21 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 59254387596; Mon, 23 Mar 2026 23:15:45 +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=1774307745; cv=none; b=LmafEyVkf/sntKpbxoFswZoNZasfKyqhgAyjE83CzN3ssBP7c8o+S/ZmYsdG9JcV8FeW6ZJeTySabtvno044qH/q+eOXabCJaSV4lKKAIOCbrUiEyBqkRkJpPHshNOcKfF5IEQvqsHPGO2rGtKbuiD731hCs6TQa7o5VAOeWPM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774307745; c=relaxed/simple; bh=Z1nIZLeoxb98TWw70o0hO/Y6NrW1kS5M/KiHOgpnygQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dgHUoNwQzlyOU9ltSlaEU8UVFnSKngQ0CTWDwT6LkQB75yxy/L310VPYHA5WAzxJ8hsM0j2KlFr70M+dpsnfnWI/9oZW9lynncPcsXZtrMe4slM+vqnF+nuQnzMKupMs8M7xZxAslBWHaMfy+T07a26ODpOTzBYjj+vmHDxHiZ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q5yydVUq; 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="Q5yydVUq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12013C2BCB0; Mon, 23 Mar 2026 23:15:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774307745; bh=Z1nIZLeoxb98TWw70o0hO/Y6NrW1kS5M/KiHOgpnygQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q5yydVUqpqiwnomNgbxwEbtmAZhljkYMPVfddPIOY8MHs670ZwRkshNhjKACcpyqj UXGdbuW3aC6ygNvSQRh63A6Vm3MKNumaRlwrWu0QGtVA2hBIiLP+51U4tByUyRr9Oc 7f29kyj0Ib+buceF5JQSK1Sxs+UqAJ7aUuiLA8HPJSGyO0qkVTSusH1XxouH/GpdiC yz3JlMmLII9kUKLaU9V4q2CTvbrwn53+2P6VCMOqd3pGPWi2o/1I6hlpihFpOpp7wo DWyLl+zXS2LfYTvDmG79gDpl8bY+O2c8DilXB+dNsvHYPfcyJcrXW0BwKMfWoTsima pch5opspDVcuw== 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 v5 10/10] selftests/damon/sysfs.py: pause DAMON before dumping status Date: Mon, 23 Mar 2026 16:15:35 -0700 Message-ID: <20260323231538.84452-11-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260323231538.84452-1-sj@kernel.org> References: <20260323231538.84452-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..b8d6e0f8fd906 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 + for 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