Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question of bpf code #8231

Open
xixiliguo opened this issue May 22, 2024 · 1 comment
Open

question of bpf code #8231

xixiliguo opened this issue May 22, 2024 · 1 comment

Comments

@xixiliguo
Copy link

below/src/bpf/exitstat.bpf.c
Comment show that code logic will check tas->signal.live as last thread, but I never found it in all files
so comment is wrong?

// sched:sched_process_exit is triggered right before process/thread exits. At
// this point we capture last taskstats to account resource usage of short-lived
// processes. We also check tas->signal.live counter to determine if this thread
// is the last thread in a process and thus is also a process exit.
SEC("tracepoint/sched/sched_process_exit")
int tracepoint__sched__sched_process_exit(
    struct trace_event_raw_sched_process_template* args
) {
  struct task_struct* task = (struct task_struct*)bpf_get_current_task();
  u64 pid_tgid = bpf_get_current_pid_tgid();
  u64 now = bpf_ktime_get_ns();
@brianc118
Copy link
Contributor

Good catch. sched_process_exit is triggered on thread exit and we aren't checking signal.live so this means we end up catching threads not just processes. Now I think about it, it may be a bit confusing since this means we are showing threads not just processes in the process view.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants