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: 177540 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7962981vqy; Tue, 12 Dec 2023 11:48:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IEtq6t65i/nV65idYkzdca04hA1sQl5ukSimtM2dICvFTEqpZ/NqYF33UXOK1tQF7LBphBJ X-Received: by 2002:a17:90a:5787:b0:286:742e:47b8 with SMTP id g7-20020a17090a578700b00286742e47b8mr5310037pji.3.1702410524298; Tue, 12 Dec 2023 11:48:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702410524; cv=none; d=google.com; s=arc-20160816; b=EykhgXGQRt5YIA9FjfsuTYGkRkKny9BYPHb4CWzCp0bfVZEeEhnEwBf2omxEI9ptNZ VBO/70n5/UjjQI+1Y2UHzVAlUB4/epMoyCz6qlU7oQ9oRN1yEYNXcG3BxGk6jE2z8s8j xBNmngi2N1dA25aIvg9NqmYIsWHpUJL1ZLN+HgiBIMRHSVW45wjox/Ks/1bSIYwAH1Pu 5TSgCVMA0qU197AG95hMPDAdrB9SdnQUwn7dY4c8ZVRuH5N3cwUyJeu1rCkPzMJ7iFE1 m35RuweVhwZxMopWrW6ouT5qcbiP3UggobxIE1OBmlH8qgQqy5TUW49zGgW0L7xIGhAt zfKw== 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 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id x30-20020a17090a6c2100b0028876b8b056si8438266pjj.118.2023.12.12.11.48.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 11:48:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; 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 23.128.96.33 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 45D628047D62; Tue, 12 Dec 2023 11:48:40 -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 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:40 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785106817967025551 X-GMAIL-MSGID: 1785106817967025551 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 = []