From patchwork Sat Dec 2 00:08: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: 13476686 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 2B6F1C10DC1 for ; Sat, 2 Dec 2023 00:08:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 16E078D007D; Fri, 1 Dec 2023 19:08:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0F8EE8D007C; Fri, 1 Dec 2023 19:08:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DEEB48D007D; Fri, 1 Dec 2023 19:08:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C857F8D007C for ; Fri, 1 Dec 2023 19:08:14 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 9A8D3A039F for ; Sat, 2 Dec 2023 00:08:14 +0000 (UTC) X-FDA: 81519940908.21.7BFD2DC Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf15.hostedemail.com (Postfix) with ESMTP id EC1FFA0011 for ; Sat, 2 Dec 2023 00:08:12 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=uXPiW5Mb; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf15.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=1701475693; 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=HB7YT4DZo+K0VqrRFyhIZVeyqMtkSZH657BYvby+SPg=; b=UWm+aTtMEg7raWR5ceD4Q6jDs7COsE49Jxlbg8z0ZwDcTzyVku8nVtPfmZ82hFBAMt2tKj 45Vqknz94v6pzaqnAHpc7Ek5INewhqehlaSv2a8iMQFrE6kb0BkJY9LddB0duppduHn6vb dGgJPt3/gQ6Ct2HHaGamaurpiRxNXSU= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=uXPiW5Mb; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf15.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=1701475693; a=rsa-sha256; cv=none; b=IZ6+kxzWW5SK7tx0omvF+eq2ABWwgfHGJKB2QlcYeBSujcmQ2dp807+dDbSFE0vYpY+sNo ki3AOZ45s+fg1/NQjZSpF7Yi53pqlO+HoX6E9ZW31YJ7C+wWvxBvxPNQZgr3yeB9RSYuco 1qubcK1U7MH8emLIRHncT5bcKQHCLno= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 3F16C622BA; Sat, 2 Dec 2023 00:08:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90E4BC433CC; Sat, 2 Dec 2023 00:08:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701475692; bh=dA3cXZTPwGuBFjfk7vBFspKqwxyw85dB6htp3+62oIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uXPiW5MbtvQcnrRYD9LYG6mn7RPYtIY3MPhQVnAIMhOAdgc6mI0apmxk5JCelCtZv 6Ef9xyeOkzma+9AS+KiXQD8I/La8iDXltv9baKzkgE40yj4y6v44bDlF1mayazsOI3 SZFeTh4Tmcj02tZnymikNK28FWnUE/o8TbsvA9jgSaCvsqcaXZZVQW4sGpyxYe9loS 65NI2gsSjyWNLTNdcdhF48SDc0MkwKk/ahnphuUPocqrvxadSAe2Ob54OKR3XrkyhS WA+RUPrD1WxoIt4tCTJQpKbfR3p09U/4BYqfCsjWEzLdX8FSzD8WCxE124eZnpBkaY E1BPJj/Hl8xpA== From: SeongJae Park To: Cc: SeongJae Park , Andrew Morton , Shuah Khan , damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 3/5] selftests/damon/_damon: implement sysfs updat_schemes_tried_bytes command Date: Sat, 2 Dec 2023 00:08:04 +0000 Message-Id: <20231202000806.46210-4-sj@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231202000806.46210-1-sj@kernel.org> References: <20231202000806.46210-1-sj@kernel.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: EC1FFA0011 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: nsp46mzpyidjunhb7euhsu93z6e1w7nt X-HE-Tag: 1701475692-723065 X-HE-Meta: U2FsdGVkX1+Zdk3qEDwwqUnyHlXtyBMu67HOCfUfYmQQyUmXXZhkLiOMLRJGuOShJryM0cWxYQGpz9HGiJKacBsn5AkMC8xgayNv3Ur1/vvG7CspUlfm3Pjg2Eyx8seTYeyGzRo4nAFLS/0PNWXtFf6vgMQODO6MJqx13Gcdtv6HGEDHvuMTIkBgYhmk+DSg85Amk+Epllf1fQ1ECU2Bar5YzH1Kpq/nF37RPU+1UA+hK+xoGXXdyem/aTDSLZzrBd4CmJHGQl3P/D0E8Vx2ONzVYZMohGP77OXxfoPbOQoozD8p041saPOstjd6/Vt3En0Ga4fTKb7HXhreb9n8up8mKDjYRjObJaWGrqZHL51SCKo/M4CB/vTNJFWhRsFS6JTGhNjDB2fEzFC82pqCqmZucrrGST1gq1Lbp7gcCYeLbk1XvzGdj3xIqoCUzL9PUUrsPodEDvoSpksDeU5Qm8BMXc8nfgZ2EH/X6CpelrQ4rxXA/UM4GHtCnvGi7YYt5P9w5eoGcQbnNnIZKSEXR15QSaY2dZ5vMPbsgdO35pqBZjjYAdLIv3aQctnJ/EZ4GKKz2gkxj6Pgjyh9HnjDJhjDvJQHTju0VQfwzyNhnLE+iEZe/EqZMOki37HIcriKhuY7PvCW4vK0Z/pYojXjB88emB3Dk869Us9CTPEKatZtdZ952ZszlTcHyEkpvoMdHmPjosHzV+4oMfA+m0XO1fKtGjXUa+RIBIX6y140gKYtg+Z0ReUqclDTFN2Xhy06Ikxa/JoSGocHs8uwn/4m6SjEw09pB5qn7aerc7JhJGqh9I1edXgfVqy+orHove3ySzIogSnL5IOmhkSKN7uFB8G/kgjCmLLJa4GIgd+a29lMMzTHH+IYLnKdP0FrKbUazvyYhL5JjKrtOeuqoj0teMvr+Sqf1G6uEm6sacQoEaEdGJ3MPPwIOD/nSWk0O2SNLY7AWlvPzsWhH6q4sjj Y3t/sJZy EBHBz1DETRFAdyIv5wkeRGlbgBWHiXvP4kwExtn4SDIvPlDfMmd06bh4NLkU1XZj0kr0vaTZWyDhZQgX6LEUSQBku//+ORwfhv0V9c+MOYqf57IGfadBbeL4MBKLY7c3ld5ovsdUAwMsA7AkpdZGdSQncHmzz5wvFRKAAdFLxBsmYuIG+XtzFfH4SNecNnmZhi3Z0GBxlmY9+jpwCWXhakL6C88YEDdSrOdhyogfDu+wXi0E8eXmKLE64ZvaHjc0AhGxNywLwHd9yERbmo5oIOuOUIElgjg9nALgP 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 in the test-writing-purpose DAMON sysfs interface wrapper Python module. It is not only making the update, but also read the updated value from the sysfs interface and store on the Kdamond python objects so that user of the module can get it by reading the field of the object. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/_damon.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/testing/selftests/damon/_damon.py b/tools/testing/selftests/damon/_damon.py index 6b99f87a5f1e..e98cf4b6a4b7 100644 --- a/tools/testing/selftests/damon/_damon.py +++ b/tools/testing/selftests/damon/_damon.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 = []