Skip to content

Commit

Permalink
Remove waiting_for_zombie state, use waiting_for_reap instead
Browse files Browse the repository at this point in the history
  • Loading branch information
rocallahan committed Aug 13, 2023
1 parent 2033698 commit b512b7a
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/RecordSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ static bool handle_ptrace_exit_event(RecordTask* t) {
if (may_wait_exit) {
t->did_reach_zombie();
} else {
t->waiting_for_zombie = true;
t->waiting_for_reap = true;
}
return true;
}
Expand Down
3 changes: 0 additions & 3 deletions src/RecordTask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ RecordTask::RecordTask(RecordSession& session, pid_t _tid, uint32_t serial,
next_pmc_interrupt_is_for_user(false),
did_record_robust_futex_changes(false),
waiting_for_reap(false),
waiting_for_zombie(false),
waiting_for_ptrace_exit(false),
retry_syscall_patching(false),
sent_shutdown_kill(false),
Expand Down Expand Up @@ -838,7 +837,6 @@ void RecordTask::do_ptrace_exit_stop(WaitStatus exit_status) {
}

void RecordTask::did_reach_zombie() {
waiting_for_zombie = false;
// Remove from address-space and fds list since we really aren't associated
// with them anymore (and we can't be used to operate on them)
as->erase_task(this);
Expand Down Expand Up @@ -1653,7 +1651,6 @@ bool RecordTask::may_be_blocked() const {
emulated_stop_type != NOT_STOPPED ||
(EV_SIGNAL_DELIVERY == ev().type() &&
DISPOSITION_FATAL == ev().Signal().disposition) ||
waiting_for_zombie ||
waiting_for_ptrace_exit;
}

Expand Down
5 changes: 1 addition & 4 deletions src/RecordTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class RecordTask final : public Task {
bool is_waiting_for(RecordTask* t);

bool already_exited() const override {
return waiting_for_reap || waiting_for_zombie;
return waiting_for_reap;
}

bool is_detached_proxy() const override {
Expand Down Expand Up @@ -799,9 +799,6 @@ class RecordTask final : public Task {
// This task is just waiting to be reaped.
bool waiting_for_reap;

// This task is waiting to reach zombie state
bool waiting_for_zombie;

// This task is waiting for a ptrace exit event. It should not
// be manually run.
bool waiting_for_ptrace_exit;
Expand Down
5 changes: 0 additions & 5 deletions src/Scheduler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,6 @@ bool Scheduler::is_task_runnable(RecordTask* t, WaitAggregator& wait_aggregator,
return true;
}

if (t->waiting_for_zombie) {
LOGM(debug) << " " << t->tid << " is waiting to become a zombie";
return false;
}

if (t->emulated_stop_type != NOT_STOPPED) {
if (t->is_signal_pending(SIGCONT)) {
// We have to do this here. RecordTask::signal_delivered can't always
Expand Down
2 changes: 1 addition & 1 deletion src/record_syscall.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6830,7 +6830,7 @@ static void rec_process_syscall_arch(RecordTask* t,
tracee = nullptr;
}
}
if (tracee && (tracee->waiting_for_reap || tracee->waiting_for_zombie)) {
if (tracee && tracee->already_exited()) {
// Have another go at reaping the task
tracee->did_reach_zombie();
}
Expand Down

0 comments on commit b512b7a

Please sign in to comment.