pcp
pcp copied to clipboard
investigate feasibility of QA test for oomkill bpf PMDA module
Here's a cgroup example:
Single concat, runs inside 10MB
jkoch@jkoch:/sys/fs/cgroup/user.slice$ sudo systemd-run --scope -p MemoryLimit=10M perl -e '$a .= "A" x 1024'
Running scope as unit: run-r43d2f5e56b8847fea964d1d1a0bc19ec.scope
[completes]
With a loop, is terminated:
jkoch@jkoch:/sys/fs/cgroup/user.slice$ sudo systemd-run --scope -p MemoryLimit=10M perl -e 'while (1) { $a .= "A" x 1024 }'
Running scope as unit: run-r9ae1c624743547f58b4abdb773a73498.scope
Killed
Verifying:
jkoch@jkoch:/sys/fs/cgroup/user.slice$ sudo journalctl --since -5m | grep oom-kill
Aug 10 09:45:38 jkoch kernel: perl invoked oom-killer: gfp_mask=0xcc0(GFP_KERNEL), order=0, oom_score_adj=0
Aug 10 09:45:38 jkoch kernel: oom-kill:constraint=CONSTRAINT_MEMCG,nodemask=(null),cpuset=run-r9ae1c624743547f58b4abdb773a73498.scope,mems_allowed=0,oom_memcg=/system.slice/run-r9ae1c624743547f58b4abdb773a73498.scope,task_memcg=/system.slice/run-r9ae1c624743547f58b4abdb773a73498.scope,task=perl,pid=100884,uid=0
Originally posted by @jasonk000 in https://github.com/performancecopilot/pcp/pull/1612#discussion_r942681513
@andreasgerstmayr it does sound a little risky, and maybe also something that will be difficult to make reliable/deterministic across many kernel versions. FWIW, there's also /proc/pid/oom_score that may help with focusing the oom-killer's attention, from memory its writable.
Originally posted by @natoscott in https://github.com/performancecopilot/pcp/pull/1612#discussion_r942970115