From patchwork Tue Apr 26 23:17:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 12828066 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F32F3C433EF for ; Tue, 26 Apr 2022 23:18:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 68DC96B0075; Tue, 26 Apr 2022 19:18:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 63BF86B0078; Tue, 26 Apr 2022 19:18:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 52A746B007B; Tue, 26 Apr 2022 19:18:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id 41FCA6B0075 for ; Tue, 26 Apr 2022 19:18:01 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1EB452787C for ; Tue, 26 Apr 2022 23:18:01 +0000 (UTC) X-FDA: 79400595162.14.FD72F5E Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf20.hostedemail.com (Postfix) with ESMTP id 6E3BC1C005E for ; Tue, 26 Apr 2022 23:17:57 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BF933619E3; Tue, 26 Apr 2022 23:17:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEE5CC385AD; Tue, 26 Apr 2022 23:17:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651015079; bh=Ac9sX0cFu6qC2OwtEEo2VbhjwI2Cs/TjEkOWCiwxUHk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DyHJBDugogDeufQMDnDXEnfyoCbLHqNjRY8Z4se5aWlgrp4Fe4jjiQMUtk/BnXdjD Yf+kqTq0l5z5Nz/5ZQHi3Axn6iWNz6a4iGzE+LJgNpuEuQzYilPda1ms31a53a7qUj tDH31TkAui+//hvP55k/AGL0PaJ8r524KZGRD6M995+ziZ0+xp1boCeJDFLaefYsdy ANCY5ezgb1DeCVzjh7r9evaRGiQXohDP+QoELqZcCJwnefTqw2oEfHbdN4FoIzMp6Q xdWXIQXod1pHyCH6PF63lkWbZdfsUij9U10WDHDPd1dgovtY3tlElUvvrLN0qBggwj OvCDbB/KL9GtQ== From: sj@kernel.org To: akpm@linux-foundation.org Cc: linux-damon@amazon.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH 2/3] mm/damon/sysfs: support fixed virtual address ranges monitoring Date: Tue, 26 Apr 2022 23:17:49 +0000 Message-Id: <20220426231750.48822-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220426231750.48822-1-sj@kernel.org> References: <20220426231750.48822-1-sj@kernel.org> MIME-Version: 1.0 Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=DyHJBDug; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf20.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 6E3BC1C005E X-Rspam-User: X-Stat-Signature: 8xr3ebjzaf3tmx74qegfd5yjs1tudm7e X-HE-Tag: 1651015077-471311 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: SeongJae Park This commit makes DAMON sysfs interface to support the fixed virtual address ranges monitoring. After this commit, writing 'fvaddr' to the 'operations' DAMON sysfs file makes DAMON uses the monitoring operations set for fixed virtual address ranges, so that users can monitor accesses to only interested virtual address ranges. Signed-off-by: SeongJae Park --- mm/damon/sysfs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index 719a286d378f..767ab8c33e4d 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -1694,7 +1694,7 @@ static struct kobj_type damon_sysfs_attrs_ktype = { /* This should match with enum damon_ops_id */ static const char * const damon_sysfs_ops_strs[] = { "vaddr", - "unsupported", /* fvaddr is not supported by sysfs yet */ + "fvaddr", "paddr", }; @@ -1844,9 +1844,6 @@ static ssize_t operations_store(struct kobject *kobj, for (id = 0; id < NR_DAMON_OPS; id++) { if (sysfs_streq(buf, damon_sysfs_ops_strs[id])) { - /* fvaddr is not supported by sysfs yet */ - if (id == DAMON_OPS_FVADDR) - return -EINVAL; context->ops_id = id; return count; } @@ -2136,7 +2133,8 @@ static int damon_sysfs_set_targets(struct damon_ctx *ctx, damon_sysfs_destroy_targets(ctx); return -ENOMEM; } - if (ctx->ops.id == DAMON_OPS_VADDR) { + if (ctx->ops.id == DAMON_OPS_VADDR || + ctx->ops.id == DAMON_OPS_FVADDR) { t->pid = find_get_pid(sys_target->pid); if (!t->pid) { damon_sysfs_destroy_targets(ctx);