Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp1407853rdb; Fri, 1 Dec 2023 16:10:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFlpHl3rysG37Dw2ZavV6emvjLK9QCtJoOEG5vBY/TJXPts3xBPeTK5bwWAf7SXnRWTTONo X-Received: by 2002:a17:90a:a08e:b0:286:6cc1:77f6 with SMTP id r14-20020a17090aa08e00b002866cc177f6mr275332pjp.57.1701475851299; Fri, 01 Dec 2023 16:10:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701475851; cv=none; d=google.com; s=arc-20160816; b=wrvFLbx2ts0B0LeDNUAYCo5TJX9mh/OmIOwfXTXISkjp+b60SDGVUfPIMDUH35ZYMA C02BbhUI4XkR6DudruO5LMTg+6XaQGxrmnN56uU8x+H7ql4PjJ8ilQ2akc/9SCEMHhKZ kLJFeEBQphq4eO1OTO65d+RyyhJaZTiNCtlR/in2CvSbGO+KVNhCxca3IGs9O5hEmx/P wTKWxC2WdQUkkBdXQm0m10yE50VOC37s9JDO19WK03ZQqvkc4RA17dvv8Xb4IkFAEMWL vl7LJz4CBle3u97Ja6NNQkvWAPM69KevhwnqWhVgij2eafSeV0tkblWGRraiq+HECFSz gz6Q== 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=FzQSkGprvCjYi1PSKTyL9VXCZYB/89pkL/cEpZOg+KI=; fh=W+de0FjxL1MlRh6Ly02q9tA2/xTz2DOJsg1VkI/mHfI=; b=WrkVg/gLARFqgRUfqmjRZsE26ctCasYhQkqRk7Wesc0LCr3yJLxvk4e2GtMzjTpeKf 2RsL+nyHLa/wH936PYkYb152Q8iRTxkiAXZedPsMDxbP6CMppjoCSeVbb6WcUy4ha1n7 8MVvVdD6LsxUiLYpBAWKbsMtDY1u70L1j/YCVo5APtwSjiP2YjTsMMnCpqinJflF+RAx FUZJIxri0jeDhbV3ilXpxZEFySVwQQoYwcgSZ3D8P/XFWsJkUpnuIxKBX+x6SZfzULry gVaAGmusea+f/4A9n54Xq/z/XDfOsyMZyPjGTHTOlPOfn3gw8b6Wnk85oBvwxkKK4u6e CyQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=eS0GQJL0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id x14-20020a17090a46ce00b0028669c1a54bsi543298pjg.141.2023.12.01.16.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 16:10:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=eS0GQJL0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 3F75880859AF; Fri, 1 Dec 2023 16:10:43 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442003AbjLBAKW (ORCPT + 99 others); Fri, 1 Dec 2023 19:10:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235382AbjLBAKE (ORCPT ); Fri, 1 Dec 2023 19:10:04 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09EDB386F for ; Fri, 1 Dec 2023 16:09:10 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4343FC433CB; Sat, 2 Dec 2023 00:08:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701475692; bh=RPGqDNVbRfHZdHfv52ZXw/68V6PB6K+dkXKHSqnAU/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eS0GQJL0HFbLi29VHlV8HHJ66TzvYLdR6ptWgktTsJ+ve9HpARkVXJ/lTBvWM6PZ0 PcWeIAFDosQS6fItHLeCOtbITCASeM/mpK+1bIDecMd3ZDk/GHSdwSI8rnxo4RmEM6 /owzTnEWigKz9PIuqsPveep8ynF6jpKJAPEq+17cmIjo57c/pnE1yffaPTz36+nU3y OovjM/a6n6c2AdBjkFzAk9sPQdD0WWldR607zXYsbdhafadiPe8M1QDMtrlJrVqFvq k2Ig07layGEKD0GjJSSonWptIfJPglIdFsIUjlUhxMw+0sxb4t6zaS7yXbnIipwjtx r0vwISU4ttEjg== 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 4/5] selftests/damon: add a test for update_schemes_tried_regions sysfs command Date: Sat, 2 Dec 2023 00:08:05 +0000 Message-Id: <20231202000806.46210-5-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=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 pete.vger.email 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 (pete.vger.email [0.0.0.0]); Fri, 01 Dec 2023 16:10:43 -0800 (PST) Add a basic test for verifying accuracy of DAMON's access monitoring functionality. The test starts a program of artificial access pattern, monitor the accesses using DAMON, and check if DAMON gets working set size with reasonable amount of error rate. Note that the acceptable error rate is set with only a naive assumption. Failure of this test may not always mean DAMON is broken, and we could adjust it in future. Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/Makefile | 2 + tools/testing/selftests/damon/access_memory.c | 41 ++++++++++++++++ ...te_schemes_tried_regions_wss_estimation.py | 48 +++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 tools/testing/selftests/damon/access_memory.c create mode 100755 tools/testing/selftests/damon/sysfs_update_schemes_tried_regions_wss_estimation.py diff --git a/tools/testing/selftests/damon/Makefile b/tools/testing/selftests/damon/Makefile index d2105d41ea25..1363987709c6 100644 --- a/tools/testing/selftests/damon/Makefile +++ b/tools/testing/selftests/damon/Makefile @@ -4,6 +4,7 @@ TEST_GEN_FILES += huge_count_read_write TEST_GEN_FILES += dbgfs_target_ids_read_before_terminate_race TEST_GEN_FILES += dbgfs_target_ids_pid_leak +TEST_GEN_FILES += access_memory TEST_FILES = _chk_dependency.sh _debugfs_common.sh TEST_PROGS = debugfs_attrs.sh debugfs_schemes.sh debugfs_target_ids.sh @@ -11,6 +12,7 @@ TEST_PROGS += debugfs_empty_targets.sh debugfs_huge_count_read_write.sh TEST_PROGS += debugfs_duplicate_context_creation.sh TEST_PROGS += debugfs_rm_non_contexts.sh TEST_PROGS += sysfs.sh sysfs_update_removed_scheme_dir.sh +TEST_PROGS += sysfs_update_schemes_tried_regions_wss_estimation.py TEST_PROGS += reclaim.sh lru_sort.sh TEST_PROGS += dbgfs_target_ids_read_before_terminate_race.sh TEST_PROGS += dbgfs_target_ids_pid_leak.sh diff --git a/tools/testing/selftests/damon/access_memory.c b/tools/testing/selftests/damon/access_memory.c new file mode 100644 index 000000000000..585a2fa54329 --- /dev/null +++ b/tools/testing/selftests/damon/access_memory.c @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Artificial memory access program for testing DAMON. + */ + +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + char **regions; + clock_t start_clock; + int nr_regions; + int sz_region; + int access_time_ms; + int i; + + if (argc != 4) { + printf("Usage: %s