oom_scoreとbadnessの関係は何ですか?

oom_scoreとbadnessの関係は何ですか?

2本の記事を読みながらhttps://lwn.net/Articles/391222/そしてhttp://man7.org/linux/man-pages/man5/proc.5.html私はこれらの用語oom_scoreと悪いことに触れました。どちらの数字も同じ基本的な意味を持ちます。数値が大きいほど、ホストにメモリが不足すると、関連タスクがOOMによって終了する可能性が高くなります。

これら2つの数字の関係は何ですか?

編集:私の推測はoom_score= max(badness + oom_score_adj、0)ですが、まだ証拠が見つかりませんでした。

ベストアンサー1

次のようになります。

oom_score=不良*1000/総ページ数

カーネルコードベースhttps://github.com/torvalds/linux/blob/master/fs/proc/base.c#L549

static int proc_oom_score(struct seq_file *m, struct pid_namespace *ns,
              struct pid *pid, struct task_struct *task)
{
    unsigned long totalpages = totalram_pages + total_swap_pages;
    unsigned long points = 0;

    points = oom_badness(task, NULL, NULL, totalpages) *
                    1000 / totalpages;
    seq_printf(m, "%lu\n", points);

    return 0;
}

おすすめ記事