Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4878030rdb; Tue, 12 Dec 2023 11:48:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHCCn9/QOkVb47IW9UzGzp070U8sf0dckTHolM42a7IxOGinFpYduaUvrj2dsfu0xFt/AW4 X-Received: by 2002:a17:902:b689:b0:1cf:a4e8:d2be with SMTP id c9-20020a170902b68900b001cfa4e8d2bemr5643514pls.12.1702410527644; Tue, 12 Dec 2023 11:48:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702410527; cv=none; d=google.com; s=arc-20160816; b=sxcscmzx4UCP7i8O1xnTy1njMlNUuB5jNbFI/aameZ8n2/+DnXxhfKZs9Vi4CWR8b6 K4PjIGy8ymf4TDu/wYUjWYl7BuwUjmg2tyBczrMqYXwbddS9TlO01GNRsb2D6dE1jJo0 u4w4DFuSFW6SKTR9OLWw1WViK5YqJTUcxGXH1VCoFH3ERoG9/bX6fk8JXIFq5gUONzzc SkLi8WoDcFQNUVy9v799XL39tRHWhJe9hDM3srLYM5FA08wK4d8ciHA8Ra+JMI31vkdC NWiV9VPr7iHgLfUH2yY2SIrvzKDpaDPMiPBBVjrphKrSRowwsPuthwb1psxd+1biz86t V+zw== 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=OmvM+Y2FtxKz6jGKR0l+2q1tvSwz1CLoD0z+sYwxxRsDRpMHIyVN7uFfn/Lhk5qAai iB1uS6KHaphrI0TSkHhxwZhDXg4POU/4uBKdVgNGxPjI5KeESKEYYUSiLPhyK/u04swJ pwophKVaJ7D1vPmZmRONAy64YkD/BY6iSk1Uj5Ch34Y8wbCGmpmN2MGc4mYAuIBUY1T2 wiB8DK86n6HfHby+R9xxgujoUleBKlJ8oEb9mNGXcZkGC6rUANnIsXl5hDX4HakdVhb4 wzuyLsO0Y7kn+wfu3F2flCowuKI86YbwG+yNWWGjDEYqk+ZuUZOmefDm56AQqEdZ87Cs g//Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Zp604m9f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id jb13-20020a170903258d00b001d06d5f9ad1si148409plb.59.2023.12.12.11.48.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 11:48:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Zp604m9f; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 5D5638047D57; Tue, 12 Dec 2023 11:48:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377306AbjLLTs1 (ORCPT + 99 others); Tue, 12 Dec 2023 14:48:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377286AbjLLTsV (ORCPT ); Tue, 12 Dec 2023 14:48:21 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57B68A6 for ; Tue, 12 Dec 2023 11:48:27 -0800 (PST) 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Tue, 12 Dec 2023 11:48:45 -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