Skip to content

Commit

Permalink
tools/oomkill: Use task_struct->tgid as PID
Browse files Browse the repository at this point in the history
The OOM target PID should be task_struct->tgid.

Signed-off-by: Hengqi Chen <[email protected]>
  • Loading branch information
chenhengqi authored and yonghong-song committed Jan 15, 2022
1 parent 8f40d6f commit 2c31dd7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/oomkill.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
void kprobe__oom_kill_process(struct pt_regs *ctx, struct oom_control *oc, const char *message)
{
unsigned long totalpages;
struct task_struct *p = oc->chosen;
struct data_t data = {};
u32 pid = bpf_get_current_pid_tgid() >> 32;
data.fpid = pid;
data.tpid = p->pid;
data.tpid = p->tgid;
data.pages = oc->totalpages;
bpf_get_current_comm(&data.fcomm, sizeof(data.fcomm));
bpf_probe_read_kernel(&data.tcomm, sizeof(data.tcomm), p->comm);
Expand Down

0 comments on commit 2c31dd7

Please sign in to comment.