Skip to content

Commit

Permalink
debug output: declutter process table
Browse files Browse the repository at this point in the history
Before:

startup_selftests: dry-running oom kill...
pid     1: badness  -1 VmRSS      -1 uid   -1 oom_score_adj   -1 "systemd"
pid     2: badness   0 VmRSS       0 uid    0 oom_score_adj   -1 "kthreadd"
pid     3: badness   0 VmRSS       0 uid    0 oom_score_adj   -1 "pool_workqueue_release"
pid     4: badness   0 VmRSS       0 uid    0 oom_score_adj   -1 "kworker/R-rcu_g"
pid     5: badness   0 VmRSS       0 uid    0 oom_score_adj   -1 "kworker/R-rcu_p"
pid     6: badness   0 VmRSS       0 uid    0 oom_score_adj   -1 "kworker/R-slub_"

After:

startup_selftests: dry-running oom kill...
  PID OOM_SCORE  RSSkiB  UID OOM_SCORE_ADJ  COMM
    1        -1      -1   -1            -1 "systemd"
    2         0       0    0            -1 "kthreadd"
    3         0       0    0            -1 "pool_workqueue_release"
    4         0       0    0            -1 "kworker/R-rcu_g"
    5         0       0    0            -1 "kworker/R-rcu_p"
    6         0       0    0            -1 "kworker/R-slub_"
  • Loading branch information
rfjakob committed Apr 7, 2024
1 parent c2be924 commit 7e252c1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion kill.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,15 @@ void debug_print_procinfo(procinfo_t* cur)
return;
}
fill_informative_fields(cur);
debug("pid %5d: badness %3d VmRSS %7lld uid %4d oom_score_adj %4d \"%s\"",
debug("%5d %9d %7lld %5d %13d \"%s\"",
cur->pid, cur->badness, cur->VmRSSkiB, cur->uid, cur->oom_score_adj, cur->name);
}

void debug_print_procinfo_header()
{
debug(" PID OOM_SCORE RSSkiB UID OOM_SCORE_ADJ COMM\n");
}

/*
* Find the process with the largest oom_score or rss(when flag --sort-by-rss is set).
*/
Expand All @@ -422,6 +427,8 @@ procinfo_t find_largest_process(const poll_loop_args_t* args)
clock_gettime(CLOCK_MONOTONIC, &t0);
}

debug_print_procinfo_header();

procinfo_t victim = { 0 };
while (1) {
errno = 0;
Expand Down

0 comments on commit 7e252c1

Please sign in to comment.