From patchwork Sat Dec 2 00:08:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13476687 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6437AC4167B for ; Sat, 2 Dec 2023 00:08:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A475C8D007E; Fri, 1 Dec 2023 19:08:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9CFC88D007C; Fri, 1 Dec 2023 19:08:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 897BE8D007E; Fri, 1 Dec 2023 19:08:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 6F5B18D007C for ; Fri, 1 Dec 2023 19:08:15 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 43D89A0384 for ; Sat, 2 Dec 2023 00:08:15 +0000 (UTC) X-FDA: 81519940950.14.C79B16C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf04.hostedemail.com (Postfix) with ESMTP id A1CA940018 for ; Sat, 2 Dec 2023 00:08:13 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=eS0GQJL0; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf04.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701475693; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=FzQSkGprvCjYi1PSKTyL9VXCZYB/89pkL/cEpZOg+KI=; b=N+kQRpzHEomePTVoyjSWswl2uZMTIgccYz551sUEXfubuqfgM+P1DRkBw7UNy3XKLmprFs mdp2PLRORNe39ysVk5BU902mm9VtLZaXxnZTExTXLzUrNIqjE6WOv30Nz6sPuQK3TqWBOc vmDmRD1V+leBE1xe4EHgdmFdFcdr7vI= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=eS0GQJL0; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf04.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701475693; a=rsa-sha256; cv=none; b=1tW7I6sHw1eJMoBnuIIDFABwmlZ2pPEjr9OQNlNFsL6i7SbiEBkY47fw0qDgtw/OnKUvCv K6IfrPsP1AZmrUfcLZ+vyZl7bOZyrt0pCLJYYN96Si9Psmbwx65zsnmB339Kr6ufxDkq7m 4v5jJXF40BsFQIzFVff1+TEIESSdxvk= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id E3ED7622BF; Sat, 2 Dec 2023 00:08:12 +0000 (UTC) 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 To: 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 X-Rspam-User: X-Stat-Signature: zdqz8ye7bpnhwhtjcatopaakubgyn8q9 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: A1CA940018 X-HE-Tag: 1701475693-650195 X-HE-Meta: U2FsdGVkX19S47vvUUSxdKR02SWZLTVCeJNQAb1sGt5gsJb6DQdYqgmHMhwcBm4jABs4HyxbUMr2tGVL+uoOj7TVUOeFVceKpmPRnhKWWDb6R5cTjPCj6z37ntPc/5NbfrmNIXIEqR9bFPBzgwrpWoNB04n/wBXhAMtsaA4FpY8eLSNvx95BKMYrLlRr4bPT6sAhlsEcMqNI4VxIIWqt2Cg6QCjTy/9ASiUoMxd2mq3U39GPxi8LEYhG5Egy2ZgMjJLpaPebThbfFpmOMQpBcNZS2DWRIsUd9zQluaJP5+85uP1xMqHAVCxcyvX1dHek6l9yxGnSPZqQZHovfCmI//8/z5PqjijhuwqS9FX1om5f3iEOaIWYWEjKOrD6yNf02husCidYAJ9QbUzpiks6Zepz9/JQ2P3z4pvcveMOFPAVP+X7Vd6699sY9EcrwRGKqEtbhaXdF5ej4YILSVnByAkJbrCzfsWWWlIqAvmA0GC/QRIYdQQI2YMaqwRhxxva7T/rRfvtarAbeNcibgoRECxO1nLeGSKGLrEZRz/+lyOF4Vpx8wUotd3gm/D2UgpR4m0FBgfORNlDGArY+w8QFU2e8qndUfX9+pildPlSJRlGf7crc7ghSEEdxQ5BY9uF8QHUaqsVRyBudqv/2ksy94usypI1YLlcEbhp7zTHURxTfhFbpJl+buaFQwe1qAzu1yaiqfbIRIJ656G1MU2uVLxQrYja81oqvU0JYrwRKP+oVNg3izSxg1XejNOYmTMyuidEL3otO/AuIyCF6FEajsAeE3xRC7tC54Vy0Yx4bHJmJ0VLuPKW8ICEBE4kID49no0oK/UJ+q/+A7bD/q2mEcD031ieMwCnsDH8pDN2/WLTnzhRsMCyG3NV7KJ5pK2gYhy9ROS05vtFQ2dre0TS9kBKb6lOkSUvbWELBY5C7U3DRJfV5fUL4RP+hr+EtyzyU/9ja//TOUW3KGmxo8J hmFbrxEs kvUoFvA1wEwORZA7y6ziVcImM2BIp8WfWr+VG1PIKEu+aq56cmoT2AUdtRFl1bQ9JIan7qIdQzPtzQ59sRJGkjKmUPKTbiJAIXhKdWVovJEgGBolmbOxj+fBb4qtcgPdH6Lg3QjwZIUht30JXo7MMtSqJItdoyvOFzl76v4YPFJZv0hC6/Ae01ftnb2OAjugHxWkCtzG3+J9s7zPD4xl0WJoXbd4DC67WZA73O+lheiKC0pAuujueHF6ETcpsefaHpGNRhpA6zRXydrbXUaiUYqJbNag2aGdnvCiM X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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