diff options
author | SeongJae Park <sj@kernel.org> | 2024-04-15 13:53:24 -0700 |
---|---|---|
committer | SeongJae Park <sj@kernel.org> | 2024-04-15 13:53:24 -0700 |
commit | 7f18fd430165fb52d92e6410025c382290e44590 (patch) | |
tree | 27c4fa7508afd1ce4d20789850fe09e8f60aef94 | |
parent | a25188c7ca61851b368e18caf0a8cbf7e92a51ad (diff) | |
download | damo-7f18fd430165fb52d92e6410025c382290e44590.tar.gz |
_damo_records: Poll target processes if exist
If 'damo record' is started with target command, the target process is
the child of 'damo', so becomes zombie process when it is finished.
Then because zombie process is still a valid process from DAMON's
perspective, kdamond is not terminated, and 'damo' hangs. Do the pid
polling if any target process exists.
Signed-off-by: SeongJae Park <sj@kernel.org>
-rw-r--r-- | _damo_records.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/_damo_records.py b/_damo_records.py index 3c0faa85..d8641279 100644 --- a/_damo_records.py +++ b/_damo_records.py @@ -673,8 +673,16 @@ def __poll_target_pids(handle): return True def poll_target_pids(handle): - if (not handle.poll_add_child_tasks and - handle.mem_footprint_snapshots is None): + has_pid_target = False + if handle.kdamonds: + for kdamond in handle.kdamonds: + for ctx in kdamond.contexts: + if _damon.target_has_pid(ctx.ops): + has_pid_target = True + break + if has_pid_target: + break + if has_pid_target is False: return False rc = __poll_target_pids(handle) if rc is True and handle.mem_footprint_snapshots is not None: |