[PATCH] memcg_stress: survive OOM by targeting the stressors
Andrea Cervesato <[email protected]>
| Newsgroups | gmane.linux.ltp |
|---|---|
| Message-ID | <[email protected]> |
From: Andrea Cervesato <andrea.cervesato-IBi9RG/[email protected]> The single-cgroup subtest intentionally lets one process fault in the whole memory budget to push the system to its memory ceiling, so hitting the OOM killer is an expected part of the stress. The problem is that the OOM killer could reap the driver script, turning that expected pressure into a spurious TBROK. Mark the stress processes as the preferred OOM victims. A killed stressor is already reaped and cleaned up by the test, while the driver survives and reports the result. Fixes: 02961a7b2bb4 ("memcg_stress_test.sh: Fix reserved mem calculate") Signed-off-by: Andrea Cervesato <andrea.cervesato-IBi9RG/[email protected]> --- On some systems this might happens: [ 244.207623][T117130] kirk[3061]: memcg_stress: start (command: memcg_stress_test.sh) [ 244.391438][T117164] memcg_stress_te (117164): drop_caches: 3 [ 1444.509722][T119900] kirk[3061]: memcg_stress: end (returncode: -1) [ 1444.629434][T119934] kirk[3061]: memcg_control: start (command: memcg_control_test.sh) [ 1445.856012][T120020] mem_process invoked oom-killer: gfp_mask=0xcc0(GFP_KERNEL), order=0, oom_score_adj=0 --- testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh index 47cac9af8bec970b7fb338c5469ab73d55267740..14a5ddeeaa45a1bc5e30b2fa7640bcb1effbd94b 100755 --- a/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh +++ b/testcases/kernel/controllers/memcg/stress/memcg_stress_test.sh @@ -71,8 +71,12 @@ run_stress() for i in $(seq 0 $(($cgroups-1))); do ROD mkdir "$test_path/$i" memcg_process_stress $mem_size $interval & - ROD echo $! \> "$test_path/$i/$task_list" - pids="$pids $!" + pid=$! + ROD echo $pid \> "$test_path/$i/$task_list" + # Make the stress process the preferred OOM victim so that memory + # pressure kills a stressor rather than the driver script. + echo 1000 > "/proc/$pid/oom_score_adj" 2>/dev/null + pids="$pids $pid" done for pid in $pids; do --- base-commit: 4898cb95b01b8a3ab5e1ea752990deca7a66ca34 change-id: 20260703-fix_memcg_stress-0c6669bfa5f6 Best regards, -- Andrea Cervesato <andrea.cervesato-IBi9RG/[email protected]> -- Mailing list info: https://lists.linux.it/listinfo/ltp