From patchwork Tue Dec 12 19:48:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13489827 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 DF15AC4167D for ; Tue, 12 Dec 2023 19:48:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 34C086B0358; Tue, 12 Dec 2023 14:48:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2CF836B0359; Tue, 12 Dec 2023 14:48:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 170F56B035A; Tue, 12 Dec 2023 14:48:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id F2DCA6B0358 for ; Tue, 12 Dec 2023 14:48:29 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CE8D51C12CB for ; Tue, 12 Dec 2023 19:48:29 +0000 (UTC) X-FDA: 81559203138.16.0802602 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id 2FBD940005 for ; Tue, 12 Dec 2023 19:48:27 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Zp604m9f; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf27.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702410508; 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=QuD5Lj5B/Vt0wxh8dAGum/6mAE1lfinwFDN/yBtOIpRmsV2j8GzFfM97f4rmEUGeg6iZvB r4N4gsQFesvCB8M3LCBK8EvK4aAcRz3PDVwAXKgX3AilnKBz9iSZTO/tCRCmcTT3IyMeLZ n91B70eYwgEZQ/VDLC7AWC/aIgNQ21w= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Zp604m9f; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf27.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702410508; a=rsa-sha256; cv=none; b=y2MUO6QNzwWjDXeMfUPO7u0tqS2ORIyIiCvCSCwlCnws68As5OlkEDmgiHtpW3G9fpdn+8 CPe179vyAGn4+yvonH8YnYgUMpaLjGKLPQQd6L2SgHXNkMw1KqtcFRgWScGNVBOOdUVK3c jchVlOdy5ffStREocamF9wKfW+tId7U= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 5ABC461300; Tue, 12 Dec 2023 19:48:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E92EC433C7; Tue, 12 Dec 2023 19:48:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702410507; bh=KLuaGh8EwddqX7r2J8YW9fbCxq8vkVUE+TA3xcNvnkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zp604m9ftO6CMnttej87Sh6VqLpo04BjspyTqtAXT+YNv+UIX/RoNfTg/V8Y4/+v7 7pXqEGOTc5Y6XxCRWrKt+/e3xzZGonBbtqWSI+WT0SWjfaWW2ZMItPC1+QK7sec6wv ij4Ozs5y4003odbvfBk1OpZbHUCDdHbapSaOe1TsKjrYpY0nfNqeDQ0dcJskywxToH jq83xtlZhvR3wpX4cTV0/8CsLQdBB7OZ37T0Su6s1GlBmDPBUibW7/EMVvdHNPt5Sx EQM2SVuASgPb4Vdu0AdQUPE4ZP/4x8RCpZC7vkdjuv108qv1TQtoo2Be1g9CKCsZMt 2zScFDV0Pw8AA== 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 v2 3/5] selftests/damon/_damon_sysfs: implement updat_schemes_tried_bytes command Date: Tue, 12 Dec 2023 19:48:08 +0000 Message-Id: <20231212194810.54457-4-sj@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231212194810.54457-1-sj@kernel.org> References: <20231212194810.54457-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 2FBD940005 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 6iu1m6tpy9q1femj3xqyks87q3zg6qrq X-HE-Tag: 1702410507-909463 X-HE-Meta: U2FsdGVkX1/yu0dW8+w6tqcL8yEqjaMWZetB8hCXKUBehSmruCY6Qx7vpZIjkPFWXpUSGwOPO1VUNllciqHj7oAq8tbLjLF0hZJWNyyTrAEaBXByjbmDvnm3vmMIwQ3wPRniKnDNfeBlkD9uD9Z+KjTqXb7poJ0znmv4ScZEdK4IIS5/uuJ45IODrhxggST7us0feyK7rO5ToyFyP2CCzVsF5s3ku5RZcUtavaWJ0V/XOAZnKLy282aoUwIQ2YeILUppSIjJJdsamphd26RN0etYUflSXnwt5AfwzuzDmAKuC52ivULxgRVDUNRULsnVhdoaP5ZlTGRsluD0tedh0K6dnz9dUPbMLkAXB4QpPr/+bKD6QkbHr3Yh7Mgb8b3GmuKHs6oGaoLAavE/PshEMeOUuEYZmoZSyNCqbR30xfukjDhiw/9uwCtgSzjJjOxtGaSoaONcVBY/DQj2F1TdSHcis8pFASLT+XK8rmz5jAk2B0RbdpC0NvPRw/+NcO0BJJafiQlTDtN1aUqAWdpGIa0bMwOC1UNwLES/fRrYP0cfeb/6BsmqymgDTnxf3wJz+/mp+o0rCXxEkNTvbqJib9VxiZQYbVJeXLfeizGOkt9vrGYcoc3u86cswDgPD+G/hy6yzn9Jvflsht6X3Y2olQbZbSVcLerYHkFczN7b2qQRM5tRgqjpHte3CG3xq+88D71iLpl5De4lDNvD0RLFr9gYr8MPUrmTelQihOIMdAltPc/7ccpRjT2qr9DdDvO0OTfh6gQnvSCFM1W8dfMtbYonnmfDU1sEqGZYa2M8xHzIo5V7J4dIvu4TlBQ3/zd+AEn9rmAB8kVcoo7q2y7pObzAUIJyYP3dUd0mSJ+/2/DEPSKKpPRnATQefB9120t1P2jxFmlAABaQnXEnDAg0RmttMUYfTlmthhNIJja2zChxQlHWPoQrax1398XuirXXwZQKDXFcQKB0an3clQ7 0tuXbKVA Kt8HK+F63GhtWWezy7SOuXZ6aKmVCOeY2ez7AC7VrAtyjeIt0dNdaRhNvkEMXG2ScrOXN5llPEVMJSeLXONi5zIMCNBFhP8uVsTO6MAc7lcs0LNZtpqr1zjwiaq4z9FEkYCaWJeV8PUBTcWrQiM+eQlXwUW9mFV72qjw4W6ozcZA3HVnbXq8QCSBSisRXuWhUZ7duKh41f7UwjK5CN2QoyS6C8CDRlAzrTtII6TsPpHg7QFtBJZQeCnLNWeHTCcsb45o4r7hcGU0Z0u9P3W8Lx3N9mtycZ49Gsdtl 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 = []