From patchwork Tue Feb 25 22:23:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 868312 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBFE121481A; Tue, 25 Feb 2025 22:23:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740522219; cv=none; b=IxocFemDDfgI5aqZqSip651g6sctsj/LoN4/L9LuwY7JCUSN2egv5jr50mWTglH7cV9Fpm2IeCj4oWL0GZYxvDXokB9RmNFwzvGduexFEcc132a+a6ByQGbzuI0ZZ0XqbJTLsGV1d2hNMKXENvfaY18FaepvKnfIzA7Sp45W1vs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740522219; c=relaxed/simple; bh=tpWLGxlVf/4BpHaXx5/fixUy6zdm68z/SbHuewfrcEc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DZi0FPBKJLG6/nwqcYOZVHrjvDO3lqsi+jxMnkmCkZN8b7zf71lkroLFsexgjgsVIdqDkCCv4XTkjq3gvMgjFJuk7lo4fTMpy4/Jn0RiAAj927/ui48HKz0nPNZrs/eQOY5QtblEy0cuqfFMW+UHv0CV7cj8zyMm2GGK7MdhvII= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jWWcxIsF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jWWcxIsF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91F85C4CEE7; Tue, 25 Feb 2025 22:23:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740522218; bh=tpWLGxlVf/4BpHaXx5/fixUy6zdm68z/SbHuewfrcEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jWWcxIsF2IncuVjeXyx7WphGUorWp+m13Tbpub2EWCXKeluqggOAnnP4/G/4qV8EC cSFf2COGUWDTC6nph6vuVsMX/H8iTJ1It5s3Lqu/ukZlT7kVVYwd9705nw820lnO+t z6Jo7AFBT4fC8gKWvN2fY4vcyclMN5FPA+5AwkuXlANEIDbfmLPPiBhBJqwxkWU7hC QASROGmWrkVlnE0GdwQIWKT0H5wiVIcgsJklhO3/HrBS9fJNxZNe+lbD99z7+teVpU vYPHteMXN3kRkKwv1DoyVvlBvAyp2jTpxkN/gHoUHxJQDlO0+XbU6uqoyBu+KQUp7W KXwA1caOlkhMw== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org Subject: [PATCH 1/3] selftests/damon/damos_quota: make real expectation of quota exceeds Date: Tue, 25 Feb 2025 14:23:31 -0800 Message-Id: <20250225222333.505646-2-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250225222333.505646-1-sj@kernel.org> References: <20250225222333.505646-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 damos_quota.py assumes the quota will always exceeded. But whether quota will be exceeded or not depend on the monitoring results. Actually the monitored workload has chaning access pattern and hence sometimes the quota may not really be exceeded. As a result, false positive test failures happen. Expect how much time the quota will be exceeded by checking the monitoring results, and use it instead of the naive assumption. Fixes: 51f58c9da14b ("selftests/damon: add a test for DAMOS quota") Cc: Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/damos_quota.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/damon/damos_quota.py b/tools/testing/selftests/damon/damos_quota.py index 7d4c6bb2e3cd..57c4937aaed2 100755 --- a/tools/testing/selftests/damon/damos_quota.py +++ b/tools/testing/selftests/damon/damos_quota.py @@ -51,16 +51,19 @@ def main(): nr_quota_exceeds = scheme.stats.qt_exceeds wss_collected.sort() + nr_expected_quota_exceeds = 0 for wss in wss_collected: if wss > sz_quota: print('quota is not kept: %s > %s' % (wss, sz_quota)) print('collected samples are as below') print('\n'.join(['%d' % wss for wss in wss_collected])) exit(1) + if wss == sz_quota: + nr_expected_quota_exceeds += 1 - if nr_quota_exceeds < len(wss_collected): - print('quota is not always exceeded: %d > %d' % - (len(wss_collected), nr_quota_exceeds)) + if nr_quota_exceeds < nr_expected_quota_exceeds: + print('quota is exceeded less than expected: %d < %d' % + (nr_quota_exceeds, nr_expected_quota_exceeds)) exit(1) if __name__ == '__main__': From patchwork Tue Feb 25 22:23:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 868311 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8451B219A93; Tue, 25 Feb 2025 22:23:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740522221; cv=none; b=mAOuzEwPl19M8vFynhhJ8RCHFjoB0CpElvV1fgfYPu+CinG3jkTSLqgak9dzWpHzs8Rfzg4vlEu0B6SXfA4DFjVk0qHPGjynqjtpfTritODZwIE0WK6Tw3a6hOuU6NKRaD+EfW/y3ICFgqqUxK4foQ0fPkBBkVkTqgxqqUO8gY8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740522221; c=relaxed/simple; bh=JZwrDWNwK0HGwgbbnUAETnfdZFPS3H25nSzCsf8e/C4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dssNFQsn7nEb3lK6cocTmBcs24XHeDk3p757q4ymNNHtC6dLMb1AoPEbuxRQvfKaqNQnC+52Jy8ntYN17yxmOazhiZj325PCJI+DAaB5FkAVJBogM31+dFwGNOTN9ttoR6Ru3b0oeEhbxn/YpXTo6cPfPEn6RKy/URjXpMeAmyM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=S66W9kHZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="S66W9kHZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C15F3C4CEE7; Tue, 25 Feb 2025 22:23:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740522220; bh=JZwrDWNwK0HGwgbbnUAETnfdZFPS3H25nSzCsf8e/C4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S66W9kHZZShg8xZlcQ533Ohn8T+1do/8o72DrPZ2fNwWyRvPGR7e3p1nLBNM6lOYD 3toGrsMjMc//M4hGKTPTB3s78O9hrdbCHlo+AD0EqnU2zAVSwfqqZfv4BakSmdyJCV m7lNZ48We5IKAq3puevP6JLpbJcdJEtMRLYQX+eOPhaEPR1iaYhMtErRQvmhWuMpGl zNsMZF3FvtkOuAyxphChsIcljZbXj7ErHf1l3iQjzAcS3zFNj2a1uL0MnZgQyi6Y0a KnFR2rqlwbq4oYUlj4hleJXVioXQkHhOisYWyziPULl1L2jll3EAtWzB1nq/SK9edi gsbniAPsLXUFQ== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , Shuah Khan , damon@lists.linux.dev, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org Subject: [PATCH 3/3] selftests/damon/damon_nr_regions: sort collected regiosn before checking with min/max boundaries Date: Tue, 25 Feb 2025 14:23:33 -0800 Message-Id: <20250225222333.505646-4-sj@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250225222333.505646-1-sj@kernel.org> References: <20250225222333.505646-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 damon_nr_regions.py starts DAMON, periodically collect number of regions in snapshots, and see if it is in the requested range. The check code assumes the numbers are sorted on the collection list, but there is no such guarantee. Hence this can result in false positive test success. Sort the list before doing the check. Fixes: 781497347d1b ("selftests/damon: implement test for min/max_nr_regions") Cc: Signed-off-by: SeongJae Park --- tools/testing/selftests/damon/damon_nr_regions.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/damon/damon_nr_regions.py b/tools/testing/selftests/damon/damon_nr_regions.py index 6f1c1d88e309..58f3291fed12 100755 --- a/tools/testing/selftests/damon/damon_nr_regions.py +++ b/tools/testing/selftests/damon/damon_nr_regions.py @@ -65,6 +65,7 @@ def test_nr_regions(real_nr_regions, min_nr_regions, max_nr_regions): test_name = 'nr_regions test with %d/%d/%d real/min/max nr_regions' % ( real_nr_regions, min_nr_regions, max_nr_regions) + collected_nr_regions.sort() if (collected_nr_regions[0] < min_nr_regions or collected_nr_regions[-1] > max_nr_regions): print('fail %s' % test_name)