Skip to content

tools/oomkill: add -s option to print victim user stack trace - #5597

Open
adityagrewal wants to merge 1 commit into
iovisor:masterfrom
adityagrewal:oomkill-user-stack
Open

adityagrewal wants to merge 1 commit into
iovisor:masterfrom
adityagrewal:oomkill-user-stack

Conversation

@adityagrewal

@adityagrewal adityagrewal commented Nov 18, 2026 •

Copy link
Copy Markdown

Fixes #3654

Add -s / --stack to oomkill to capture and print the user-space stack trace of the OOM-killed process (oc->chosen) using KFUNC_PROBE and bpf_get_task_stack() with BPF_F_USER_STACK (requires BTF and Linux 5.9+). Without -s, the existing kprobe behavior remains unchanged.

Test output:

# ./oomkill -s
Tracing OOM kills... Ctrl-C to stop.
17:29:29 Triggered by PID 4362 ("oom_test"), OOM kill of PID 4362 ("oom_test"), 5120 pages, loadavg: 1.01 1.06 1.01 4/1032 4362
  Victim stack trace:
    __memset_avx2_unaligned_erms+0x80 [libc.so.6]
    layer_two+0xd [oom_test]
    layer_one+0xd [oom_test]
    main+0xd [oom_test]
    __libc_start_call_main+0x80 [libc.so.6]

@adityagrewal
adityagrewal marked this pull request as draft November 19, 2026 18:09
@adityagrewal
adityagrewal marked this pull request as ready for review November 19, 2026 23:19
@adityagrewal
adityagrewal marked this pull request as draft November 19, 2026 23:20
@adityagrewal
adityagrewal marked this pull request as ready for review November 19, 2026 23:24
@adityagrewal
adityagrewal force-pushed the oomkill-user-stack branch 3 times, most recently from 219c01b to fc62b59 Compare November 20, 2026 00:23
@adityagrewal

Copy link
Copy Markdown
Author

@brendangregg Hi Brendan, would you mind giving this PR a look? TIA :)

@adityagrewal
adityagrewal marked this pull request as draft November 21, 2026 00:07
@adityagrewal
adityagrewal marked this pull request as ready for review November 21, 2026 13:43
@adityagrewal
adityagrewal marked this pull request as draft November 21, 2026 14:23
@adityagrewal
adityagrewal force-pushed the oomkill-user-stack branch 5 times, most recently from 90c60a2 to c5b9736 Compare November 21, 2026 15:11
Signed-off-by: Aditya Grewal <aditya1998yr@gmail.com>
@adityagrewal
adityagrewal marked this pull request as ready for review November 21, 2026 15:15

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

Application stack trace on oomkill.

1 participant