Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4865340rdb; Tue, 12 Dec 2023 11:22:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLDiVR2Znk/TCmquvtZubRdq63Ee0CRsp+WE3q6lSwD3oUcwa5JIeUJH2Pgp/gVamUSsb/ X-Received: by 2002:a17:903:1d0:b0:1d2:fb13:ac1b with SMTP id e16-20020a17090301d000b001d2fb13ac1bmr3410904plh.135.1702408955212; Tue, 12 Dec 2023 11:22:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702408955; cv=none; d=google.com; s=arc-20160816; b=07MWZq01Mh43xxx+0ywomx9Dye5AVYULq4uaxIw7tQnpqkgJ0uHkO8tUIJ29+zRGt2 8y/LRytWDOXqJ4vFHLrjjOGOQa0rQtTkWkU/aw2cDLIuEN4SSN6M/86mWGk7fpS7XlVo 81PT4M98Jwd9YHvraffJOOua7MpwZRo66/9fNezzdQQz6aP3LapRAIe3qrpmNMmersdM X9Hvm2twbNjDaNuO9qIdrgdlyKZm2N9PPrp4iXAHgWVBVq0xz/cfLITfSGs96yJnwzjq UeFBQokcKBWIFrIome1Eto5mfDLCWlwXE3foFZxCGtLawVRZsvtvqXBKT9LqpXZKjNll FgTw== 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=PE3Ud83rQ8nRHqXBgbyIm2JkshmsAUhc2ptltMD0cvg=; fh=PV0ZDS9MAwuHGm3U8NepHC6E1wQ5gVZboglwja8WNVk=; b=KaB0KkOZmIGd8GdQ/agXoCLgaYbvCP2SwgRFHvKACfdpKrVPnPbay+jE/E4hwn2GKo MTuvLOR/luOOAy+Qj9fm5uAyAPh62z01WlOlC0SO6KgZfWSdve3GsTv7Yym/ETiNA+mh 0PQSXCJIMF3kwdRX4GGyG9y9HRxYoHhPds94xaYmaNTwa4eKVz2ELxuu7gq4KaCJHAAg +ck3eJaPALR/IxHVvMUZjvkbX2p2oY0/POb4sjZtB+xE0GWv4qgSHiCCbEpABfEdCpgV KemxFnNMKiRzAFT23mmqjQ453GyAbzzNeWNW0/+2kOMSlnV2HGnzPHz/qZkJYiHTOCBE ez2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lSUwxVgD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id i8-20020a17090a2ac800b0027d22d5aa7esi8295354pjg.46.2023.12.12.11.22.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 11:22:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lSUwxVgD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 43CB580239B4; Tue, 12 Dec 2023 11:22:32 -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 S233075AbjLLTWS (ORCPT + 99 others); Tue, 12 Dec 2023 14:22:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235135AbjLLTWP (ORCPT ); Tue, 12 Dec 2023 14:22:15 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6E76B9 for ; Tue, 12 Dec 2023 11:22:21 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDE4CC433C8; Tue, 12 Dec 2023 19:22:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702408941; bh=i5eA2fXhaq3Do9ywFpJzwHOFQOS7qYLx5BFeshX3BZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lSUwxVgDk2j4cnZPH/Zy7xE7vjsRTnpogG2abp5kyPRCtT/TZgdYhJerl+EIt8XO+ AZCxf+fPMQpNamCpOTnjqC4DOxO2jnXg7wVICwPQJUTf6RfCL14WhPZuHupkqX7l0O Hq+nJ2IAFAZtDifyGfoR91Vlrlzdh0w8cg/NWZlNbz/mzlhu3X4Kwv8yuSz6GB6uHz PVUgx+D3XmLxKMS4vyobPs59mP5iwt/lGzRutQe8tew0eS6GZcND9rnTgF9gVWr8sg 0Nerc0Xi7synedvS/VCWgFV37xO/7MVPkRGY//8a+vJkxCv/bYg7Qcn9afsFwQw62R IjULLbahcHfEg== From: SeongJae Park To: SeongJae Park Cc: Andrew Morton , Shuah Khan , damon@lists.linux.dev, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/5] selftests/damon: add a test for update_schemes_tried_regions sysfs command Date: Tue, 12 Dec 2023 19:22:18 +0000 Message-Id: <20231212192218.54095-1-sj@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231212191206.52917-5-sj@kernel.org> References: 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 pete.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 (pete.vger.email [0.0.0.0]); Tue, 12 Dec 2023 11:22:32 -0800 (PST) This and fifth patch of this patchset may not cleanly applicable, since those are made on top of my out-of-tree experimental changes. I will rebase these and send v2. Sorry for the noise. Thanks, SJ On 2023-12-12T19:12:05+00:00 SeongJae Park wrote: > Add a selftest for verifying the accuracy of DAMON's access monitoring > functionality. The test starts a program of artificial access pattern, > monitor the access pattern using DAMON, and check if DAMON finds > expected amount of hot data region (working set size) with only > acceptable error rate. > > Note that the acceptable error rate is set with only naive assumptions > and small number of tests. Hence failures of the test may not always > mean DAMON is broken. Rather than that, those could be a signal to > better understand the real accuracy level of DAMON in wider > environments. Based on further finding, we could optimize DAMON or > adjust the expectation of the test. > > 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 | 55 +++++++++++++++++++ > 3 files changed, 98 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