From nobody Fri Sep 25 09:19:46 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 703BF47ACC9; Mon, 14 Sep 2026 14:20:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789395609; cv=none; b=fy4jkaE73bhdaIAcPHM4IV6qBz4V0Ej04/DlIcAh8h86y+uWf9uN1Qa58hxYakh6Rcgs0Ljq1aj/svUGFp17X/VOE6hojA5wxBJ2h++n7KeRSnhjRMPA65h5TKG8t3jouRYT2KKeJ4C+ZlDvIbVc5msQ5afc0y8oDTXUU1WTWfc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789395609; c=relaxed/simple; bh=lpaO9TLngl+800FN0Oclc9LEAPQL3PfEYQXVFjlxJKQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sptaNKqqAljDvmih4RFEQc9kZXOzA4A62c3cBuRzRbbAoFeNTH/WFUJFMHJ2rycj8w+Pr+gHHnB38/iphClIqSrgGqv/Xp5KuvLLus/P1skokTMokwJxtWe4X9KNxULf2B7eLlHAaUXu5LH+7+3vK7lv8s5KJAUhSZF4xcj7aVg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NO20yQc6; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NO20yQc6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB2811F00898; Mon, 14 Sep 2026 14:20:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789395601; bh=1oWEcWOiJS4U7UoQkNpC5ifxai4TnwShrWzXzWihbqc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=NO20yQc61hDX4N6lEy0ZsVRFihbtdYpFcBa0+s2k1rLQM8gvTKtjszXCbeuDDTz15 76VDqJeJFu2flLbl5M6wRt2uYT6yE8r1Gw+GzCyEiUJ35E8kO2r7FD7Eby8HCqK+mg ZJk9EKrPkgBUPLi6JvDaST2ejDcelGSk2FqJH1oKMIatw0pH8CQnD925cmRy6xSrbW Hx8/7t+ZogRMXXmgXMDApbAD2otaf3Ot0U5pVNhdDx7tQOvQTh+PftyYC1ZklqoLzi xq8AO1fYBApaNkjQlyQz8JHhj7ppcX6PpOYaip//+GOsz0R7YNRUbFJzHY83BJnO0x fguS+r5Extt5Q== From: SJ Park To: Andrew Morton Cc: "Zenghui Yu (Huawei)" , SJ Park , Sang-Heon Jeon , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 1/6] selftests/damon: stop kdamond on error exits of no-op commit test Date: Mon, 14 Sep 2026 07:19:46 -0700 Message-ID: <20260914141952.91465-2-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260914141952.91465-1-sj@kernel.org> References: <20260914141952.91465-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Zenghui Yu (Huawei)" The sysfs_no_op_commit_break test starts a kdamond via sysfs, but its error paths (e.g., drgn not installed) exit without stopping it. The leaked kdamond then makes subsequent tests, e.g. lru_sort.sh and reclaim.sh, skip with "Another kdamond is running". Wrap the post-start logic in try-finally so that kdamonds.stop() is executed on every exit path. Fixes: 10725cd2b09a ("selftests/damon: test no-op commit broke DAMON status= ") Assisted-by: GLM-5.3 OpenCode Signed-off-by: Zenghui Yu (Huawei) Reviewed-by: SJ Park Signed-off-by: SJ Park --- Changes from v1 - v1: https://lore.kernel.org/20260907123455.67246-1-zenghui.yu@linux.dev - Collect R-b: from SJ. - Rebase to latest mm-new. .../damon/sysfs_no_op_commit_break.py | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/tools/testing/selftests/damon/sysfs_no_op_commit_break.py b/to= ols/testing/selftests/damon/sysfs_no_op_commit_break.py index 2c65cffe6b545..81774ddc55ac4 100755 --- a/tools/testing/selftests/damon/sysfs_no_op_commit_break.py +++ b/tools/testing/selftests/damon/sysfs_no_op_commit_break.py @@ -47,26 +47,27 @@ def main(): print('kdamond start failed: %s' % err) exit(1) =20 - before_commit_status, err =3D \ - dump_damon_status_dict(kdamonds.kdamonds[0].pid) - if err is not None: - print('before-commit status dump failed: %s' % err) - exit(1) + try: + before_commit_status, err =3D \ + dump_damon_status_dict(kdamonds.kdamonds[0].pid) + if err is not None: + print('before-commit status dump failed: %s' % err) + exit(1) =20 - kdamonds.kdamonds[0].commit() + kdamonds.kdamonds[0].commit() =20 - after_commit_status, err =3D \ - dump_damon_status_dict(kdamonds.kdamonds[0].pid) - if err is not None: - print('after-commit status dump failed: %s' % err) - exit(1) - - if before_commit_status !=3D after_commit_status: - print(f'before: {json.dumps(before_commit_status, indent=3D2)}') - print(f'after: {json.dumps(after_commit_status, indent=3D2)}') - exit(1) + after_commit_status, err =3D \ + dump_damon_status_dict(kdamonds.kdamonds[0].pid) + if err is not None: + print('after-commit status dump failed: %s' % err) + exit(1) =20 - kdamonds.stop() + if before_commit_status !=3D after_commit_status: + print(f'before: {json.dumps(before_commit_status, indent=3D2)}= ') + print(f'after: {json.dumps(after_commit_status, indent=3D2)}') + exit(1) + finally: + kdamonds.stop() =20 if __name__ =3D=3D '__main__': main() --=20 2.47.3 From nobody Fri Sep 25 09:19:46 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 4C9B147ECF1; Mon, 14 Sep 2026 14:20:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789395606; cv=none; b=nbjxlZM+9USJbz5/LcHvzaYBXtcBM7YpaDo+WXnfuMZWDtxBb89+CLkZc6pjiMOsERl3kL5ElJi9XAsWjw4KtUhsifHe0nQwNT1tWAR/j3L1hF3DgObkReulWR9NMqUCc0H+dRYobXv5iXQAqNLIIjulq8p84QJnl+uuX5W9Ypw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789395606; c=relaxed/simple; bh=7ci7gxigHaN7jPfqDBRzBjI6usIiTTD9pIeSrMF+tnA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h8Z6x44uaauOUOq6HpU8boyDz7cF9ivCHlr5xOePfnGnPAt83zwGskJGCZnjszQG2huVA5lUcQCg6bLgOIjOSd+HjapawKHUQrb0iqu+/x1IB+4+CyQoSPx7Lg/SKecl19L7IR4ajvYmm7MnhQcz7B43bexsJ7llSfyPmnDecco= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NTISd//d; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NTISd//d" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AFDA1F00899; Mon, 14 Sep 2026 14:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789395601; bh=rrDgkODM8llf8jq+hclXZEjgX/fiBHh7K7zNkR9oULk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=NTISd//d9p3BIEpa0p/qxDk/GpV/LubuO5kaAosPlh7zMJZu4RN5PxiMOXsAmYxHr PEIB2PhPz8qz1huxQTukkSECJjgsViJnj3edZLoC8fQHsLE/GhA/pkWel1fyZFYRNX PjD5RSc6MZ2GklIkHFAn0YY0YmF1Ljwh+fu1QopZ4u8kWsodrlRohmnqGT9kxz+9gP elMt/MR6LAI2KIl7yhDF0FreaLTVo6BuI/rBdebioTyW+lg6CRd5dzvQ1oI2CvPAFD rKtJHxGMnFOYPGVpVaQwkcGiV9aYBliC6Q0UAUQpv9mMKCQCXl69TQqKFrPeLLnb3p 8iaOcc/QSUj+w== From: SJ Park To: Andrew Morton Cc: "Zenghui Yu (Huawei)" , SJ Park , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 2/6] selftests/damon: ignore test-generated damon_dump_output Date: Mon, 14 Sep 2026 07:19:47 -0700 Message-ID: <20260914141952.91465-3-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260914141952.91465-1-sj@kernel.org> References: <20260914141952.91465-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Zenghui Yu (Huawei)" sysfs.py and sysfs_no_op_commit_break.py dump the DAMON status collected via drgn_dump_damon_status.py into a damon_dump_output file in the working directory. Ignore it so that running the tests in-tree does not pollute git status. Signed-off-by: Zenghui Yu (Huawei) Reviewed-by: SJ Park Signed-off-by: SJ Park --- Changes from v1 - v1: https://lore.kernel.org/20260908162716.85648-1-zenghui.yu@linux.dev - Collect R-b: from SJ. - Rebase to latest mm-new. tools/testing/selftests/damon/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/damon/.gitignore b/tools/testing/selft= ests/damon/.gitignore index 2f0297657c816..226bd7c4e0728 100644 --- a/tools/testing/selftests/damon/.gitignore +++ b/tools/testing/selftests/damon/.gitignore @@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only access_memory access_memory_even +damon_dump_output --=20 2.47.3 From nobody Fri Sep 25 09:19:46 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 6CD4946AEFE; Mon, 14 Sep 2026 14:20:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789395608; cv=none; b=Bk4t03je4M9XD8bL4t3c950QynJGX5gdMQC0vPatgYMiHMRZtXr/pzfnBcM/k4+o87XfIw7qaEA7/+3KLVIP00Q9kTPCEofMArXLSBsLO/HLuJMi7/yqjO16ZvQY6MTS02Z0PWWcXuk1QKYRUSr5moVtNkoHZzvrAyz7iVIojrc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789395608; c=relaxed/simple; bh=YkUGaOGxAboONSlOCUlrI0V3DUz26aswBLoll6hE1Hw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EKYGmvJVbyO9wSZPsiSw26HFt6EXOWym7ez4eK9PS5GP3oWKJSLzXFqN0pg5fQsEhMLsr6SpD4I3/1+vss+d/GSSbMU82VzvLyM2WPp1XGqqzeaPfpNbaMS7+2anQJLi/RFiyUuRZ3B4lV2mJJOt0wo6zZHykrz7YE0shJEsz0w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QJpoxhar; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QJpoxhar" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5F381F0089A; Mon, 14 Sep 2026 14:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789395602; bh=iMSM+RY05r6OH+v1CtMIxEVXYlWKzTDj5y/6JWGPvKc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QJpoxhar5EcAr9Tj32UEKCjB7ygUKbu+YQU2MwEULu89BluCAJAvbiz8D9aLFe3YG m4O61hGCSQ0UYdO8yIgUDixQlB/et1Zirheejfmo2ktwuCi9r78kzt8BPtFgRqgAaK +V13J3DqhduxvjoE1QY0FHOAfyKFB+Pz/Ig249foADiDCtx+eEA3yPQT2WcsNgafrD OoAJudEDwKaYMoCTZQ44t5loXVYBMqre193GtpoUpCzRikHp8b7PTkneOrR/PF55Cr eRw7wbeExZ967wBmO1MYstDrdkz3rC5DwnrmueWTUku27UgrfALTFxxvXDiCtCobf3 dzdsJmnzyR7Fw== From: SJ Park To: Andrew Morton Cc: Eva Kurchatova , SJ Park , Shuah Khan , damon@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 3/6] selftests/damon: add script dir to sys.path for PYTHONSAFEPATH compatibility Date: Mon, 14 Sep 2026 07:19:48 -0700 Message-ID: <20260914141952.91465-4-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260914141952.91465-1-sj@kernel.org> References: <20260914141952.91465-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Eva Kurchatova Running these tests under Python's safe path mode, either with -P on the interpreter command line or with PYTHONSAFEPATH set in the environment, stops the script's own directory being prepended to sys.path. Some distributions (RHEL, for example) build the tests with -P in the shebang. This breaks all 7 DAMON Python selftests that import the _damon_sysfs helper module located in the same directory: ModuleNotFoundError: No module named '_damon_sysfs' Fix this by explicitly adding the script's directory to sys.path before importing _damon_sysfs, following the same pattern used in commit c3b3eb565bd7 ("tools: ynl: add script dir to sys.path") which fixed the identical issue for the YNL tools. Signed-off-by: Eva Kurchatova Reviewed-by: SJ Park Signed-off-by: SJ Park --- Changes from v1 - v1: https://lore.kernel.org/20260908214238.2680324-1-eva.kurchatova@virtu= ozzo.com - Collect R-b: from SJ. - Rebase to latest mm-new. tools/testing/selftests/damon/damon_nr_regions.py | 3 +++ tools/testing/selftests/damon/damos_apply_interval.py | 3 +++ tools/testing/selftests/damon/damos_quota.py | 3 +++ tools/testing/selftests/damon/damos_quota_goal.py | 3 +++ tools/testing/selftests/damon/damos_tried_regions.py | 3 +++ .../selftests/damon/sysfs_update_schemes_tried_regions_hang.py | 3 +++ .../damon/sysfs_update_schemes_tried_regions_wss_estimation.py | 3 +++ 7 files changed, 21 insertions(+) diff --git a/tools/testing/selftests/damon/damon_nr_regions.py b/tools/test= ing/selftests/damon/damon_nr_regions.py index 58f3291fed12a..e55239813c654 100755 --- a/tools/testing/selftests/damon/damon_nr_regions.py +++ b/tools/testing/selftests/damon/damon_nr_regions.py @@ -1,9 +1,12 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 =20 +import os import subprocess +import sys import time =20 +sys.path.append(os.path.dirname(os.path.abspath(__file__))) import _damon_sysfs =20 def test_nr_regions(real_nr_regions, min_nr_regions, max_nr_regions): diff --git a/tools/testing/selftests/damon/damos_apply_interval.py b/tools/= testing/selftests/damon/damos_apply_interval.py index 0f2f36584e48c..0bf7768b2006a 100755 --- a/tools/testing/selftests/damon/damos_apply_interval.py +++ b/tools/testing/selftests/damon/damos_apply_interval.py @@ -1,9 +1,12 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 =20 +import os import subprocess +import sys import time =20 +sys.path.append(os.path.dirname(os.path.abspath(__file__))) import _damon_sysfs =20 def main(): diff --git a/tools/testing/selftests/damon/damos_quota.py b/tools/testing/s= elftests/damon/damos_quota.py index 57c4937aaed28..879115a499bf8 100755 --- a/tools/testing/selftests/damon/damos_quota.py +++ b/tools/testing/selftests/damon/damos_quota.py @@ -1,9 +1,12 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 =20 +import os import subprocess +import sys import time =20 +sys.path.append(os.path.dirname(os.path.abspath(__file__))) import _damon_sysfs =20 def main(): diff --git a/tools/testing/selftests/damon/damos_quota_goal.py b/tools/test= ing/selftests/damon/damos_quota_goal.py index 661e4ba4765ae..fed033a0afdf9 100755 --- a/tools/testing/selftests/damon/damos_quota_goal.py +++ b/tools/testing/selftests/damon/damos_quota_goal.py @@ -1,9 +1,12 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 =20 +import os import subprocess +import sys import time =20 +sys.path.append(os.path.dirname(os.path.abspath(__file__))) import _damon_sysfs =20 def main(): diff --git a/tools/testing/selftests/damon/damos_tried_regions.py b/tools/t= esting/selftests/damon/damos_tried_regions.py index d6472e6a6e082..6941f87c10b1c 100755 --- a/tools/testing/selftests/damon/damos_tried_regions.py +++ b/tools/testing/selftests/damon/damos_tried_regions.py @@ -1,9 +1,12 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 =20 +import os import subprocess +import sys import time =20 +sys.path.append(os.path.dirname(os.path.abspath(__file__))) import _damon_sysfs =20 def main(): diff --git a/tools/testing/selftests/damon/sysfs_update_schemes_tried_regio= ns_hang.py b/tools/testing/selftests/damon/sysfs_update_schemes_tried_regio= ns_hang.py index 28c887a0108fd..625761c243b58 100755 --- a/tools/testing/selftests/damon/sysfs_update_schemes_tried_regions_hang= .py +++ b/tools/testing/selftests/damon/sysfs_update_schemes_tried_regions_hang= .py @@ -1,9 +1,12 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 =20 +import os import subprocess +import sys import time =20 +sys.path.append(os.path.dirname(os.path.abspath(__file__))) import _damon_sysfs =20 def main(): diff --git a/tools/testing/selftests/damon/sysfs_update_schemes_tried_regio= ns_wss_estimation.py b/tools/testing/selftests/damon/sysfs_update_schemes_t= ried_regions_wss_estimation.py index 16fdc6e7fc566..36e7ae5f826d8 100755 --- a/tools/testing/selftests/damon/sysfs_update_schemes_tried_regions_wss_= estimation.py +++ b/tools/testing/selftests/damon/sysfs_update_schemes_tried_regions_wss_= estimation.py @@ -1,9 +1,12 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0 =20 +import os import subprocess +import sys import time =20 +sys.path.append(os.path.dirname(os.path.abspath(__file__))) import _damon_sysfs =20 def pass_wss_estimation(sz_region): --=20 2.47.3 From nobody Fri Sep 25 09:19:46 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 0C8063C584A; Mon, 14 Sep 2026 14:20:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789395612; cv=none; b=Ah9SdRwtaCMAqDkvl1+FenhabiQ2c/G5Jmbd4DiVOcHY6QzzkHMdrS48an7rbC8Kyx78YMr126WnbLg5Stv2+EFQPuEZ6AvSPYB61FdU+KTa+qMisNwS1GjnHzZ6ABUqOlGSk+/W5yShWEj4b4b0Yr1VgEMFIYcdiXkko/BAUAc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789395612; c=relaxed/simple; bh=2q4xJ0P619evK9DKIBKz/BCbjFgZ1UrTrSqvgshqZNM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=T4RmmM8G3CgarH5Ha67/z2Xh3EqeOl7doh78EwznkVpca2opbFvrboHFZjm2xhWrnZfKUDugUSbAx7Kb/CkJZ9SJK4+fw2AxfoZsATvOSAcPSRk4bNkB0P/4OSVgGxx7wpr+7E2rLbHyCGIAqZNRkcIDYc+QPtqi9qA9XrgOtT8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Jn2zEmzg; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Jn2zEmzg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57D6A1F00893; Mon, 14 Sep 2026 14:20:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789395602; bh=Oi23zu2/PrV0Foc+v/urHYp6bcscQLI0NRalUKOBVW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Jn2zEmzg+8eiuhpnhyv9+INeK0b0PsfogpmddAwICz0n1DBUnFcadfFFpVffnaSJS vsKsEiNKXkO/Kl4FgEFeZJFiBlEyx1S6WFKEfjJvy8gnXibdwTLeQU2W9bkshneTkc XnnGaHWVx9bygDzCyMl+LfVoaw3/8ladZfooOKsSo7poW0P9Pqth+9uzTOMQCgwkf6 Ad6Qmj+4U6jMwKKl1xiZZCvg9G1nHsUbTZRmjczJg1FQxVNn/gaBOSWUYyl2QA6pjj XO0tChvfTnDPewBNPesDi411NMzSx1kV7ahtGTSRvvqq6uLtRzw90zbOj22GOOeV+0 7Hz7jeFMr+Y0A== From: SJ Park To: Andrew Morton Cc: Kunwu Chan , Brendan Higgins , David Gow , SJ Park , damon@lists.linux.dev, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, Lian Wang Subject: [PATCH 4/6] mm/damon/tests/core-kunit: improve nr_samples_per_aggr test isolation Date: Mon, 14 Sep 2026 07:19:49 -0700 Message-ID: <20260914141952.91465-5-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260914141952.91465-1-sj@kernel.org> References: <20260914141952.91465-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Kunwu Chan Test the zero sample interval case with a non-zero aggregation interval, and keep the zero/zero case to cover the zero-result fallback. Also make the overflow case use an explicit sample interval so that it does not depend on the zero sample interval fallback. Signed-off-by: Kunwu Chan Reviewed-by: Lian Wang Reviewed-by: SJ Park Signed-off-by: SJ Park --- Changes from v2 - v2: https://lore.kernel.org/20260909070711.2448346-1-kunwu.chan@gmail.com - Collect R-b: from SJ. - Rebase to latest mm-new. Changes from v1 - v1: https://lore.kernel.org/damon/20260908063635.2208922-1-kunwu.chan@gma= il.com/ - Use 0/0 for the zero-result case, consistent with damon_set_attrs(). - Update commit msg and add Reviewed-by tag. mm/damon/tests/core-kunit.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/mm/damon/tests/core-kunit.h b/mm/damon/tests/core-kunit.h index c01e6a75cadc1..a47a5cdf285c8 100644 --- a/mm/damon/tests/core-kunit.h +++ b/mm/damon/tests/core-kunit.h @@ -627,12 +627,20 @@ static void damon_test_set_regions(struct kunit *test) =20 static void damon_test_nr_samples_per_aggr(struct kunit *test) { - struct damon_attrs attrs =3D { + struct damon_attrs attrs; + + /* Zero sample interval is treated as one. */ + attrs =3D (struct damon_attrs){ .sample_interval =3D 0, - .aggr_interval =3D 0, + .aggr_interval =3D 5000, }; + KUNIT_EXPECT_EQ(test, damon_nr_samples_per_aggr(&attrs), 5000); =20 - /* Zero aggregation interval doesn't cause division by zero */ + /* Zero sample and aggregation intervals cover the zero-result fallback. = */ + attrs =3D (struct damon_attrs){ + .sample_interval =3D 0, + .aggr_interval =3D 0, + }; KUNIT_EXPECT_EQ(test, damon_nr_samples_per_aggr(&attrs), 1); =20 /* @@ -640,7 +648,10 @@ static void damon_test_nr_samples_per_aggr(struct kuni= t *test) * overflow */ if (ULONG_MAX > UINT_MAX) { - attrs.aggr_interval =3D (unsigned long)UINT_MAX + 1; + attrs =3D (struct damon_attrs){ + .sample_interval =3D 1, + .aggr_interval =3D (unsigned long)UINT_MAX + 1, + }; KUNIT_EXPECT_EQ(test, damon_nr_samples_per_aggr(&attrs), UINT_MAX); } --=20 2.47.3 From nobody Fri Sep 25 09:19:46 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 C580347ECDC; Mon, 14 Sep 2026 14:20:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789395611; cv=none; b=X8VXVRauwyLeSg4M6bitMH8W/RvEU/p1Fgx2XElhmcBJ2aJSBwqEqvHBwVe2JaaE2Z+Jq0Wyg/T98Vm5F1BFkDSG2xj0IbJQ8QIeUJzJh14apuz34YEjo+lNgleWrBkynoHrd59PKiMpiX4gIKzhfqfZG74qmjzpll4XJy+Tv3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789395611; c=relaxed/simple; bh=oWpASUYUf1MQMHW4bMHsGYFavW7vYaxsR0F3qU5hKqo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QsZl9xziwKFm3WiSC2Tnzu1PXU+pSdq6SaIo8xo7iVFT5+410ci0KB+LptDz8VMTUGSEX/5uKNvrFBCk+w3ntRjhx4uYf3QZqaOBnV5nJT8g0meGYtvkM13C/9ox/tgTllFurGp7yL8D+CCIxCwrJv6s5EW3wck0hMpvtFrqES8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LLAJKd3P; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LLAJKd3P" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAA581F0089C; Mon, 14 Sep 2026 14:20:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789395603; bh=dgI5/uHVhGU/u/lFuomzDRYuBHWw9s688+WF+gpTSJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=LLAJKd3PZfZJLA2mghR2o10iU2ZFbouGRqCNO/Ce//Yu5KWtT1Fb38VyB0L08FCuA ncSquZ0pmtNWj09L9+9wH2JgvSpzPbs7SgODgo6YgH3GSKvF/qjQlYeTePa6G5siUg Bdkg6gHk7rP4yAUkljf3cR/u0FwM7Cj2fwmJgMDjiFuBju+cdwiJREDEMEH9yQgYbO ET0CLVkg/JmOcmT9J9rFgy34S3fSuxjIQ0YUeeiTvpQJ9720JaTYJ+mHvdGA6WdHWp 90jegwteY51FeTim7QjFIXDEhCh7EoyJQSAdw/7FXomE+LQsrBn3qMa+PV60IZjwTR 9hmHyPPPeai3g== From: SJ Park To: Andrew Morton Cc: Liew Rui Yan , "Liam R. Howlett" , David Hildenbrand , Jonathan Corbet , Lorenzo Stoakes , Michal Hocko , Mike Rapoport , Randy Dunlap , SJ Park , Shuah Khan , Suren Baghdasaryan , Vlastimil Babka , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 5/6] Docs/mm/damon/design: clarify when qt_exceeds increases Date: Mon, 14 Sep 2026 07:19:50 -0700 Message-ID: <20260914141952.91465-6-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260914141952.91465-1-sj@kernel.org> References: <20260914141952.91465-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Liew Rui Yan qt_exceeds counts how many times a scheme's quota has been exceeded. When using the temporal auto-tuning algorithm, the effective size quota becomes zero once the goal is [over-]achieved. In this case, the quotas are still set, so qt_exceeds keeps increasing once per quota reset interval while the goal stays achieved. Clarify this behavior in the design document. Signed-off-by: Liew Rui Yan Reviewed-by: SJ Park Signed-off-by: SJ Park --- Changes from v1 - v1: https://lore.kernel.org/20260910112255.157012-1-aethernet65535@gmail.= com - Collect R-b: From SJ. - Rebase to latest mm-new. Changes from RFC v1 - RFC v1: https://lore.kernel.org/damon/20260908175105.42558-2-aethernet655= 35@gmail.com - Simplify the explanation. Do not provide a complete definition of qt_exceeds, but rather explain only the increment condition when using temporal auto-tuning algorithm, simply to prevent users from becoming confused and being unable to find any explanation. Documentation/mm/damon/design.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/des= ign.rst index cb116a82ff20b..ad09416dfb21a 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -696,7 +696,9 @@ There are two such tuning algorithms that users can sel= ect as they need. fast as possible, using maximum allowed quota, but only for a temporal s= hort time. When the quota is under-achieved, this algorithm keeps tuning quo= ta to a maximum allowed one. Once the quota is [over]-achieved, this sets the - quota zero. Useful for deterministic control required environments. + quota zero. Useful for deterministic control required environments. No= te + that the zero quota is a valid quota, and therefore ``qt_exceeds`` :ref:= `stat + ` will keep increasing in this case. =20 The goal can be specified with five parameters, namely ``target_metric``, ``target_value``, ``current_value``, ``nid`` and ``path``. The auto-tuning --=20 2.47.3 From nobody Fri Sep 25 09:19:46 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 C904345FFA7; Mon, 14 Sep 2026 14:20:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789395613; cv=none; b=Es+PbQ5gP9L9nQaw47k42QWjCSKNb9XJgmUvKx6osaVeXNeM633Lmk8h81t4d+w3AIXSz45o48qrmV5+pY/R/qSeNMMzDsPNCEm/2AEsVgW3mmLFOgwciPTQuiI/jM7kYbTFLsKt0HdelU4xcPD9UJHfmuhWLPrzzc7igXKsbc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789395613; c=relaxed/simple; bh=nZ8sBxNQ7YWHi0+fi/Xtx2/lJzrripQVnCvJiQy9XLo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TBIIXV00DlFoIVIgi5O6J7f3a8PLJlP1E2Di5qgqJxWO0VAHsJ8plDeDG7TNC4aINafAFeUZRvDKQWJYNOGAHAIGkLmOOoOaJgLvG67pyECSdiQzcen76sOdPbVN9OuqNcWwoGM0080cCG21kKpinHFvXvh9Hti5gbwlc7JZdYs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=j05Pspcw; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="j05Pspcw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C0891F0089D; Mon, 14 Sep 2026 14:20:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789395604; bh=CPk8Tagd5GI3QkdQHiiyppe9/WTPuBoNQc9NjPN9Oyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=j05PspcwD1dJGHyH/LYdc9O3hnSqtNkv2srUWvg+1Ke742GffM1skFmC9H3+a3ee9 b3fCr4TLPknIhl/o9FRyBYY+GDPpKomdzzROhn0xparyhpMRR3I8/Vs8AksRmrFxZV X/u8bVnDC6UtTFFit8QqPZ9t8+fWwOo/PUyH3ErHCMJw+gGEtTfaQ8/1gjUCzNlfu8 cg0KsMyqJX94mbtU5GVIaTkUzPbWBDNVvYKGuPBnaIisCQ/H9j05pxUCDyUUBhO6EZ l72feSfY7rOlHro2WMR01XgBStY8l+QwpVgFtmcd2z5bc66UU8Do8YGQ5wubhdUByu WEyEkLQNdOd8w== From: SJ Park To: Andrew Morton Cc: Liew Rui Yan , "Liam R. Howlett" , David Hildenbrand , Jonathan Corbet , Lorenzo Stoakes , Michal Hocko , Mike Rapoport , Randy Dunlap , SJ Park , Shuah Khan , Suren Baghdasaryan , Vlastimil Babka , damon@lists.linux.dev, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 6/6] Docs/mm/damon/design: fix typos in temporal auto-tuning algorithm section Date: Mon, 14 Sep 2026 07:19:51 -0700 Message-ID: <20260914141952.91465-7-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260914141952.91465-1-sj@kernel.org> References: <20260914141952.91465-1-sj@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Liew Rui Yan Correct incorrect references of "quota" to "goal" in the temporal auto-tuning algorithm description and fix the square bracket formatting. Signed-off-by: Liew Rui Yan Reviewed-by: SJ Park Signed-off-by: SJ Park --- Changes from v1 - v1: https://lore.kernel.org/20260911093314.156875-1-aethernet65535@gmail.= com - Collect R-b: from SJ. - Rebase to latest mm-new. Documentation/mm/damon/design.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/mm/damon/design.rst b/Documentation/mm/damon/des= ign.rst index ad09416dfb21a..707170bcd1b33 100644 --- a/Documentation/mm/damon/design.rst +++ b/Documentation/mm/damon/design.rst @@ -694,8 +694,8 @@ There are two such tuning algorithms that users can sel= ect as they need. This is the default selection. If unsure, use this. - ``temporal``: More straightforward algorithm. Tries to achieve the goal= as fast as possible, using maximum allowed quota, but only for a temporal s= hort - time. When the quota is under-achieved, this algorithm keeps tuning quo= ta to - a maximum allowed one. Once the quota is [over]-achieved, this sets the + time. When the goal is under-achieved, this algorithm keeps tuning quot= a to + a maximum allowed one. Once the goal is [over-]achieved, this sets the quota zero. Useful for deterministic control required environments. No= te that the zero quota is a valid quota, and therefore ``qt_exceeds`` :ref:= `stat ` will keep increasing in this case. --=20 2.47.3