* [PATCH] selftests/damon/sysfs.py: stop obsolete_target shells hanging the test
@ 2026-10-18 2:04 Jaeyeon Lee
2026-10-18 16:23 ` SJ Park
2026-10-18 17:09 ` Aveline Noir
0 siblings, 2 replies; 3+ messages in thread
From: Jaeyeon Lee @ 2026-10-18 2:04 UTC (permalink / raw)
To: SJ Park, Shuah Khan; +Cc: damon, linux-mm, linux-kselftest, linux-kernel
The obsolete_target test spawns three 'sh' processes as monitoring
targets. The processes inherit stdin from the test. When the test is
run via 'make run_tests' from an interactive terminal, the kselftest
runner executes it under 'timeout', which puts it in a background
process group. The 'sh' processes then try to read the terminal, so
the kernel sends SIGTTIN to the whole process group. This stops the
'sh' processes, and also the child the test has just forked to spawn
the next 'sh', before it can run 'sh'. The test then waits on that
child forever, until the kselftest runner kills it after 45 seconds.
The test passes when run directly.
Fix this by passing stdin=subprocess.PIPE when spawning the processes.
The processes then read from a pipe that never receives input, so they
stay alive and idle as the test expects.
Assisted-by: LLM
Signed-off-by: Jaeyeon Lee <jaeyeon.lee.dev@gmail.com>
---
tools/testing/selftests/damon/sysfs.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/damon/sysfs.py b/tools/testing/selftests/damon/sysfs.py
index 66c826189320..ce54fa21c09f 100755
--- a/tools/testing/selftests/damon/sysfs.py
+++ b/tools/testing/selftests/damon/sysfs.py
@@ -390,12 +390,12 @@ def main():
kdamonds.stop()
# test obsolete_target.
- proc1 = subprocess.Popen(['sh'], stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- proc2 = subprocess.Popen(['sh'], stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- proc3 = subprocess.Popen(['sh'], stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
+ proc1 = subprocess.Popen(['sh'], stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ proc2 = subprocess.Popen(['sh'], stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ proc3 = subprocess.Popen(['sh'], stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
kdamonds = _damon_sysfs.Kdamonds(
[_damon_sysfs.Kdamond(
contexts=[_damon_sysfs.DamonCtx(
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] selftests/damon/sysfs.py: stop obsolete_target shells hanging the test
2026-10-18 2:04 [PATCH] selftests/damon/sysfs.py: stop obsolete_target shells hanging the test Jaeyeon Lee
@ 2026-10-18 16:23 ` SJ Park
2026-10-18 17:09 ` Aveline Noir
1 sibling, 0 replies; 3+ messages in thread
From: SJ Park @ 2026-10-18 16:23 UTC (permalink / raw)
To: Jaeyeon Lee
Cc: SJ Park, Shuah Khan, damon, linux-mm, linux-kselftest,
linux-kernel
On Sun, 18 Oct 2026 04:04:15 +0200 Jaeyeon Lee <jaeyeon.lee.dev@gmail.com> wrote:
> The obsolete_target test spawns three 'sh' processes as monitoring
> targets. The processes inherit stdin from the test. When the test is
> run via 'make run_tests' from an interactive terminal, the kselftest
> runner executes it under 'timeout', which puts it in a background
> process group. The 'sh' processes then try to read the terminal, so
> the kernel sends SIGTTIN to the whole process group. This stops the
> 'sh' processes, and also the child the test has just forked to spawn
> the next 'sh', before it can run 'sh'. The test then waits on that
> child forever, until the kselftest runner kills it after 45 seconds.
> The test passes when run directly.
>
> Fix this by passing stdin=subprocess.PIPE when spawning the processes.
> The processes then read from a pipe that never receives input, so they
> stay alive and idle as the test expects.
Thank you for finding and fixing the bug!
>
> Assisted-by: LLM
> Signed-off-by: Jaeyeon Lee <jaeyeon.lee.dev@gmail.com>
Reviewed-by: SJ Park <sj@kernel.org>
I applied this patch to damon/next [1] tree. We are now quite close to next
merge window. It may better to focus on making mm.git more stabilized and
therefore ready for the next merge window, rather than adding more changes that
are not really urgent. I understand this series is not really urgent. Hence,
Andrew might not add this patch until next -rc1 release. In the case, I will
request adding this to mm.git after next -rc1 release. So, no action from your
side is needed for now. Let me know if you think this is really urgent.
[1] https://origin.kernel.org/doc/html/latest/mm/damon/maintainer-profile.html#scm-trees
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests/damon/sysfs.py: stop obsolete_target shells hanging the test
2026-10-18 2:04 [PATCH] selftests/damon/sysfs.py: stop obsolete_target shells hanging the test Jaeyeon Lee
2026-10-18 16:23 ` SJ Park
@ 2026-10-18 17:09 ` Aveline Noir
1 sibling, 0 replies; 3+ messages in thread
From: Aveline Noir @ 2026-10-18 17:09 UTC (permalink / raw)
To: Jaeyeon Lee
Cc: SJ Park, Shuah Khan, damon, linux-mm, linux-kselftest,
linux-kernel
Hi Jaeyeon,
> Fix this by passing stdin=subprocess.PIPE when spawning the processes.
Tested on x86-64 KVM, works fine.
Tested-by: Aveline Noir <jm5905938@gmail.com>
Thanks,
Aveline Noir
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-18 17:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-18 2:04 [PATCH] selftests/damon/sysfs.py: stop obsolete_target shells hanging the test Jaeyeon Lee
2026-10-18 16:23 ` SJ Park
2026-10-18 17:09 ` Aveline Noir
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.