From patchwork Tue Dec 12 19:12:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13489785 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 1ED42C4332F for ; Tue, 12 Dec 2023 19:12:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1799C6B0337; Tue, 12 Dec 2023 14:12:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F35A96B0339; Tue, 12 Dec 2023 14:12:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D614A6B033A; Tue, 12 Dec 2023 14:12:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id B3A1C6B0337 for ; Tue, 12 Dec 2023 14:12:19 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 87A0D160903 for ; Tue, 12 Dec 2023 19:12:19 +0000 (UTC) X-FDA: 81559111998.09.938C504 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf07.hostedemail.com (Postfix) with ESMTP id DEA4240012 for ; Tue, 12 Dec 2023 19:12:17 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rwumpu7p; spf=pass (imf07.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702408337; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gRWLBAxz+7SsKpxgT28rVVWe7oCM8SAKhqIhIhMn5oU=; b=ASfE47AeOQVBeZZ141nN98ixOqlPCJ3cjfATl1pcjnwqX3O20zTED5GdfcDOIWVzAxyHfj wTXSi/iU/CDH8BjPC61DAxzIk0wbxKnNb6q4ZmqMCPVbbHnHzL/Y7oBM5qkhk/w4406Km/ Ejk/9uE6sZpKz850HzYNeGX5uOqR3Wo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702408337; a=rsa-sha256; cv=none; b=7DcIgWWL4UxPTO1lDG45u5IacK8d0r9U6yKrCaUWP6xdUw+jwCszSk7pp6hK6maogBpbb/ V43tbAjZ824dTJJvbDWJLhnIDOCVkx0bdcCL4AKdA4mC5OZA1qdi4BdzKjKxQZta3l942v 2+hix8gEJHncklR9UKtwwYPYj7iGQts= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rwumpu7p; spf=pass (imf07.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1012C60F5A; Tue, 12 Dec 2023 19:12:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48521C433C9; Tue, 12 Dec 2023 19:12:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702408336; bh=KLuaGh8EwddqX7r2J8YW9fbCxq8vkVUE+TA3xcNvnkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rwumpu7pqmpvnDomf+Hqsnh0almVLDis4X1s3RgGsNDBz1ZNxaQgGZbkGcHD2x/om J9NHY7Nzm0oEjemCVbKBPT7iOAW3johkbPXm490MuyodKOhYIuS5rsfTARZVtZU1E5 O0kOzVSh0a+F09ETl+b3CSjG7q+9sd3xzsgXymt5ebJVzKRQJFLuL/Kao+V7ppEse+ eg2aB2v3Z5oWVnQDpYZqszt1gRobfnX8MahYjx5ZdRL1mJJw+IPIoRr07D4ilPKjIV Bft87B19yWmf4YZud7k7g/adUKpw/LAVDb87F0MOmJoi+ySJPPFGcHbGB5tIFddkKL TRJHV+KZqehZQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] selftests/damon/_damon_sysfs: implement updat_schemes_tried_bytes command Date: Tue, 12 Dec 2023 19:12:04 +0000 Message-Id: <20231212191206.52917-4-sj@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231212191206.52917-1-sj@kernel.org> References: <20231212191206.52917-1-sj@kernel.org> MIME-Version: 1.0 X-Stat-Signature: 6a6cqsppioaca5kw5omf7i54gpsu4hpi X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: DEA4240012 X-Rspam-User: X-HE-Tag: 1702408337-837993 X-HE-Meta: U2FsdGVkX1+2Y+2Kg2hAhHZApvur80CpYVD/gqwqdkQvXMuCBMucC2WaUic0Bb4A2D4bXgJgQIKbcLdFL7BEOtwDyh0d2FKm5ChcTdAtTwK1dBH5oZLXeJTBjMqZylm7vOaXpRwVGgrcrQ9l7aRx5NLBOYYR4kHGu4FAMsxI2QmDGsK3nzkatsV6eVQJl6UV9YRgpNZCvFCEfdmaHuQxUN4BRUqB7aJG2ZxY4TmxhjnCBWAgOOukZ0MGRDX721Sqy1WrXKlew+rmCmRv4OOZOdlZhNHDavIufZ44LJoHywpUOMJDgov6mzLf8LDKkK7MBaA2xj1HspAvqmDura/DeXvJyF2CHTZajmuJxY1XDbIFybQmSZm52uisHzd7bZGgqE4YurFvd1zBcoI4UYY/Z4bgFINuvKB2tf/n3MRQ9K02tFv6CgFe3nDQKymT+pMi0kJhQRyHeYiXuliNmNvsFjaUbKJIIcxBjJN6Jj0d/rJUcqP9PUqZyxECIC2sMitHh5Qx49V6wLlz0whrc0LjG6YMXNCkwsMqM+NnzqfL3Ou/lhqjOqWUDvboylRmYOWeMAIecJBOFDXKH8VAv2S+GumhfVc5GwA3ah5I+HSqWj3IEf+uz+DIg4SrI5zb8JggOotgqi6NCuSNvrKRfBtd/2rOIx6bGXfPHLNG8CuWIgQIlmJSGyScJRWdsqfF7ataKuSNQSYiCt8Hd3QU/Su/N9gQv6klvopItSOGrNE8Kd2mmQjlFPsDrDvuwV+99nUFglgmP4CETPthHUHNDZTSrl0uYJjGu67MUN8ngvvBIV2ZGzTb8Lgav480EFAZu5DwuwAiaDRMsOmxEc1tenjz1D94l2xheKHZA62tMfZ7jbD9kwUVjme7TxiCWSReBfU4lDLtnfYIrGMgzhHZjTe4RbFRl5xIPsJ29kPPLhf+70VHVRTSvfJmxNn0IAXJFutHVbQ4nHa0+IOqhw42fnK zJIJh2QG mTzRFlLAeIHyZuxs7Af49aDNK7NrAnu0iVbHs9Tr8DKP5VeReCHrNHwAKFpsY7l28y4alJQGFckV4BN2BnvJtZjpR18BsRuMMmNAl21VMnI/WrBAGPhBzXBts+btc9rLo1B+Zrg2yd8IMKxxaGrfwwQSI4SXJrPZlut0kn+akiv2bmq4aggyimUzjkdqhd5GgKuloAHR+lobft3D+htMc6QH+HzufWrWhPcvh2KzRsggAWq5KE2B2Bv6eZSQNmYq8K+fKXOT04iNuCgyZScdZ4y3Rdw/4yYx0Lk6Y 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: List-Subscribe: List-Unsubscribe: Implement update_schemes_tried_bytes command of DAMON sysfs interface in _damon_sysfs.py. It is not only making the update, but also read the updated value from the sysfs interface and store it in the Kdamond python objects so that the user of the module can easily get the value. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/_damon_sysfs.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/testing/selftests/damon/_damon_sysfs.py b/tools/testing/selftests/damon/_damon_sysfs.py index 6b99f87a5f1e..e98cf4b6a4b7 100644 --- a/tools/testing/selftests/damon/_damon_sysfs.py +++ b/tools/testing/selftests/damon/_damon_sysfs.py @@ -76,6 +76,7 @@ class Damos: # todo: Support quotas, watermarks, stats, tried_regions idx = None context = None + tried_bytes = None def __init__(self, action='stat', access_pattern=DamosAccessPattern()): self.action = action @@ -284,6 +285,19 @@ class Kdamond: err = write_file(os.path.join(self.sysfs_dir(), 'state'), 'on') return err + def update_schemes_tried_bytes(self): + err = write_file(os.path.join(self.sysfs_dir(), 'state'), + 'update_schemes_tried_bytes') + if err != None: + return err + for context in self.contexts: + for scheme in context.schemes: + content, err = read_file(os.path.join(scheme.sysfs_dir(), + 'tried_regions', 'total_bytes')) + if err != None: + return err + scheme.tried_bytes = int(content) + class Kdamonds: kdamonds = []