Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1411047rdb; Fri, 1 Dec 2023 16:18:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IGvPQRxWjNYzjH1KHNbeS9QMkdmxE1c5+2ghUHIbuoZIt08FNuF0gJBMbqQfI8igli8NBcn X-Received: by 2002:a05:6a20:4303:b0:186:a0d9:4189 with SMTP id h3-20020a056a20430300b00186a0d94189mr470363pzk.35.1701476310947; Fri, 01 Dec 2023 16:18:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701476310; cv=none; d=google.com; s=arc-20160816; b=SJSN5boPW7EquK3yV7LjP5ETZsHi6VWZsW67jXvi8t0bDK8PMoAevjjTnjkHItK/FJ icIdAqxEUKHD30LrvdaUIv/F0VWYpAr6H3bKfCdOmu0VSY3SiF4Qah6sg/UJLFSrVSBt HgPuhD6/83aulhTFRCbSxsimmnqSxttRLfcnwi/e8ttKyWDtnJNge44klP+W78HwixIw E4Ds1BI+BXcLnxlzwgkVfPYnUeA7e09BJIocyLnhbZKbCARJi9zJmEnsKwVG3JE4ADZJ 6UvC0cJ8JfnuJ6kEFANBVDSXc90SpeeeZ582Ki2fVFojjfMJhCE476wK1e0Bad4a7h1E K38Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=HB7YT4DZo+K0VqrRFyhIZVeyqMtkSZH657BYvby+SPg=; fh=W+de0FjxL1MlRh6Ly02q9tA2/xTz2DOJsg1VkI/mHfI=; b=UdDTVFSYNlMW4HyKhmOHtRDn6m/GRH+ghIcXq7f1+yh0d89LnH34vt3M9pem1iUGFv JzyyW5Nlc4q3Qv8uSyYhfsqDWXfeUOv5MuqzZcRl25opY56uze/ublCgj8CA3vblYTb9 cI0SKFekwpuxJjsM1jz4DRLDKGUEjg/61+iHYIOjYXA+PR5NiKc0Hjbl/5eRTqUDBKYo 4LjVW/RXcSjm3XnjzC16gdDn4vyGX6N+ESi+uH1YvyYx+UyV94VU7pdnUz3ZaoZMcg/w Aq++P767XWbeE9+Ta35Bh0qOgflgwG/26FpWMdY7YU/5lbFpt6DKI7ZPwoXoZTeS6oRT K4VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=uXPiW5Mb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id h10-20020a65518a000000b00565ecee8793si3999682pgq.875.2023.12.01.16.18.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 16:18:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=uXPiW5Mb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 8B1D081896C6; Fri, 1 Dec 2023 16:18:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441961AbjLBAST (ORCPT + 99 others); Fri, 1 Dec 2023 19:18:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235320AbjLBASM (ORCPT ); Fri, 1 Dec 2023 19:18:12 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FB6CD6C for ; Fri, 1 Dec 2023 16:09:08 -0800 (PST) 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 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 01 Dec 2023 16:18:29 -0800 (PST) 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 = [] -- 2.34.1