From nobody Sat Apr 4 03:05:14 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BE7533EAED; Sat, 21 Mar 2026 18:13:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774116833; cv=none; b=RqPcZQKgEVuUPyNSgX+mKaRpNFq5r4Iu32nwlpeNjqZRdTybMrYC6/QKX4TCVLcnremUKk1/k/TWDxT+ZY0ExdUs0eMBQGq10F5uJpgEqWVb99KuhKQbRqbV4A1GKDRj0v7khgG0AcxJZnlySRkQTIqQwm/4EqPjR7bitkx8iJc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774116833; c=relaxed/simple; bh=4uaA+eem3fKB2uPWGLGeH18mf1wXB30aEUf0eMGJT00=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cKuezXB52NWbSZOWv2xr6p4/8pTnAlhmYq5ob1mcq41s8u9jtO11kiNhe64JHslPZdBclGdV6HyXo3gGKn0N7w0TK+/a79Os5svGiVKTLVT/GaGjA/PPwpfPCmRG3Hi3jyDDPZ+1eEcC5RiQbAK/OiGQSF4jSYCm+i2U1c6NWpE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RB/sw3oy; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RB/sw3oy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B22DC2BCB0; Sat, 21 Mar 2026 18:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774116833; bh=4uaA+eem3fKB2uPWGLGeH18mf1wXB30aEUf0eMGJT00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RB/sw3oyJZzZe3oe/2j/45aVwyCuxSLgJi3y2xBXmpajajlFV/N42xDccH6B0Bics Utq+GYHtiuQYm+upce6/8fcjzApMvsgXe48QnxS0W2+Z6WqzQoHyhuXmnk5WyH6Spq nsPOT/XnwG5uzG2gAm9xAU1xXg0n9yNYKvF8OFba9jeqaG+hPb6ZdeuEg80ax++8DG KFKSqFNzOUpd9qBIM59v+IP/fTKW1AzwEEdQD9F45whiSPJexdhRMaUH3lxAAJpnYL NP8b7MsG6RhGe5oBzMN1hUUf+nfrIf1N4v62mqVR6UY31boEFpEe8lS3gm33ooKi9V XPON7qvYMTf2g== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 02/10] mm/damon/sysfs: add pause file under context dir Date: Sat, 21 Mar 2026 11:13:32 -0700 Message-ID: <20260321181343.93971-3-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260321181343.93971-1-sj@kernel.org> References: <20260321181343.93971-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add pause DAMON sysfs file under the context directory. It exposes the damon_ctx->pause API parameter to the users so that they can use the pause/resume feature. Signed-off-by: SeongJae Park --- mm/damon/sysfs.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index 6a44a2f3d8fc9..51893abd09472 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -866,6 +866,7 @@ struct damon_sysfs_context { struct damon_sysfs_attrs *attrs; struct damon_sysfs_targets *targets; struct damon_sysfs_schemes *schemes; + bool pause; }; =20 static struct damon_sysfs_context *damon_sysfs_context_alloc( @@ -878,6 +879,7 @@ static struct damon_sysfs_context *damon_sysfs_context_= alloc( context->kobj =3D (struct kobject){}; context->ops_id =3D ops_id; context->addr_unit =3D 1; + context->pause =3D false; return context; } =20 @@ -1053,6 +1055,30 @@ static ssize_t addr_unit_store(struct kobject *kobj, return count; } =20 +static ssize_t pause_show(struct kobject *kobj, struct kobj_attribute *att= r, + char *buf) +{ + struct damon_sysfs_context *context =3D container_of(kobj, + struct damon_sysfs_context, kobj); + + return sysfs_emit(buf, "%c\n", context->pause ? 'Y' : 'N'); +} + +static ssize_t pause_store(struct kobject *kobj, struct kobj_attribute *at= tr, + const char *buf, size_t count) +{ + struct damon_sysfs_context *context =3D container_of(kobj, + struct damon_sysfs_context, kobj); + bool pause; + int err =3D kstrtobool(buf, &pause); + + if (err) + return err; + context->pause =3D pause; + return count; +} + + static void damon_sysfs_context_release(struct kobject *kobj) { kfree(container_of(kobj, struct damon_sysfs_context, kobj)); @@ -1067,10 +1093,14 @@ static struct kobj_attribute damon_sysfs_context_op= erations_attr =3D static struct kobj_attribute damon_sysfs_context_addr_unit_attr =3D __ATTR_RW_MODE(addr_unit, 0600); =20 +static struct kobj_attribute damon_sysfs_context_pause_attr =3D + __ATTR_RW_MODE(pause, 0600); + static struct attribute *damon_sysfs_context_attrs[] =3D { &damon_sysfs_context_avail_operations_attr.attr, &damon_sysfs_context_operations_attr.attr, &damon_sysfs_context_addr_unit_attr.attr, + &damon_sysfs_context_pause_attr.attr, NULL, }; ATTRIBUTE_GROUPS(damon_sysfs_context); @@ -1470,6 +1500,7 @@ static int damon_sysfs_apply_inputs(struct damon_ctx = *ctx, if (sys_ctx->ops_id =3D=3D DAMON_OPS_PADDR) ctx->min_region_sz =3D max( DAMON_MIN_REGION_SZ / sys_ctx->addr_unit, 1); + ctx->pause =3D sys_ctx->pause; err =3D damon_sysfs_set_attrs(ctx, sys_ctx->attrs); if (err) return err; --=20 2.47.3