Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4859699rdb; Tue, 12 Dec 2023 11:12:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IFXaNA/Ci6kEb4pRcYMYl69Er4gX//PknjMrnxyXQ5RzKJnIGjHXOCKQ7pUr5ZKYc2Ljq8E X-Received: by 2002:a05:6a00:9382:b0:6cd:ecdf:b244 with SMTP id ka2-20020a056a00938200b006cdecdfb244mr4713709pfb.5.1702408349793; Tue, 12 Dec 2023 11:12:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702408349; cv=none; d=google.com; s=arc-20160816; b=MM54EkT6odoJEpW7KvzFIYyyKyhkOzGOmgOwjKEIzQvH8nzbuag8oQaygg4TO+hbqg NjMuXlL7ytfKyTgAbEBpYdt84AIX0nsMdER6ucKPmR4WBpehYlQg4q0l1jvaMdMEE1ZG wYR069cI39blJWjTSNX7Xpla0A7LyUzYoWQ2awau3iPggowN7wFgKZisGVmBjAU0rayJ JBe8m+tfVr0aPU48hNkMHTrm6L/zLJ7Hp7BBjHmW8ywdDRKQfKlDPWuWHT7kF456fQae D2XqHddu3S7Q+sKYzyFlN1ZcPxIxt8/BAAoIM8jLd5ISmvJiwfDYi2nbvnl1GsEA9oB6 Kxew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gRWLBAxz+7SsKpxgT28rVVWe7oCM8SAKhqIhIhMn5oU=; fh=9H4z7/o7y4OLn0xLmjdSk9Pth53+ED/R+iGnGlnIr7g=; b=QxEFIkIbNdxbGd8WbhRehuedMt+I1h1DB3fsvria0A5kA54zlSG/nQrSczYwovPjsH 7gkH/zrN2YWt/xmjCvFvVxlGRaI2ZSBuRxDl2wuw/SNziLuI6ny7x8qQtVRFYFOoJRsg Jh8Qqs0ME2zs75FOMo8O4WUyYj5qW0oJDNrXCEwS7lP5D39FsziBESwGCfFnd9xBMl6O LHC5E0CSn4wS493j4ELUGvc7myxaN9HopXHd8QQiwgSh93UCYsyu0WJgiApsSmYCMEaO xTEjf2uDnV2g6YWS12MkNmsu5XtOE86L3t+LDd7PW+pnh9VtEBfWHY2G6ajd459udBoP RGJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rwumpu7p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id s42-20020a056a0017aa00b006cec77b95a3si8136223pfg.279.2023.12.12.11.12.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 11:12:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rwumpu7p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 6595480477A6; Tue, 12 Dec 2023 11:12:28 -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 S235135AbjLLTMP (ORCPT + 99 others); Tue, 12 Dec 2023 14:12:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230370AbjLLTMK (ORCPT ); Tue, 12 Dec 2023 14:12:10 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FE75D2 for ; Tue, 12 Dec 2023 11:12:17 -0800 (PST) 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 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 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]); Tue, 12 Dec 2023 11:12:28 -0800 (PST) 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 = [] -- 2.34.1