Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Enze Li <lienze@kylinos.cn>
To: sj@kernel.org, shuah@kernel.org
Cc: damon@lists.linux.dev, linux-mm@kvack.org,
	linux-kselftest@vger.kernel.org, Enze Li <lienze@kylinos.cn>
Subject: [PATCH 1/2] selftests/damon/wss_estimation: handle early access_memory exit
Date: Sun,  6 Dec 2026 17:52:25 +0800	[thread overview]
Message-ID: <20261206095226.310682-2-lienze@kylinos.cn> (raw)
In-Reply-To: <20261206095226.310682-1-lienze@kylinos.cn>

If access_memory exits immediately, wss_collected is empty and the
percentile check at the end crashes with:

    IndexError: list index out of range

Check proc.poll() after the loop and fail with the child's return code
instead.

Signed-off-by: Enze Li <lienze@kylinos.cn>
---
 .../sysfs_update_schemes_tried_regions_wss_estimation.py  | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git 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
index 36e7ae5f826d..4d81d4245b0c 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
@@ -39,6 +39,14 @@ def pass_wss_estimation(sz_region):
 
         wss_collected.append(
                 kdamonds.kdamonds[0].contexts[0].schemes[0].tried_bytes)
+
+    if proc.poll() is not None:
+        print('access_memory terminated early: %d' % proc.returncode)
+        err = kdamonds.kdamonds[0].stop()
+        if err is not None:
+            print('kdamond stop failed: %s' % err)
+        exit(1)
+
     proc.terminate()
     err = kdamonds.stop()
     if err is not None:
-- 
2.53.0



  reply	other threads:[~2026-12-06  9:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-06  9:52 [PATCH 0/2] selftests/damon: handle early access_memory exit Enze Li
2026-12-06  9:52 ` Enze Li [this message]
2026-12-06 10:05   ` [PATCH 1/2] selftests/damon/wss_estimation: " sashiko-bot
2026-12-06  9:52 ` [PATCH 2/2] selftests/damon/damos_apply_interval: " Enze Li
2026-12-06 10:03   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261206095226.310682-2-lienze@kylinos.cn \
    --to=lienze@kylinos.cn \
    --cc=damon@lists.linux.dev \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shuah@kernel.org \
    --cc=sj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox