Commit de34d965 authored by David Rientjes's avatar David Rientjes Committed by Linus Torvalds

mm, oom: replace some information in tasklist dump

The number of ptes and swap entries are used in the oom killer's badness
heuristic, so they should be shown in the tasklist dump.

This patch adds those fields and replaces cpu and oom_adj values that are
currently emitted.  Cpu isn't interesting and oom_adj is deprecated and
will be removed later this year, the same information is already displayed
as oom_score_adj which is used internally.

At the same time, make the documentation a little more clear to state this
information is helpful to determine why the oom killer chose the task it
did to kill.
Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 121d1ba0
...@@ -491,9 +491,10 @@ oom_dump_tasks ...@@ -491,9 +491,10 @@ oom_dump_tasks
Enables a system-wide task dump (excluding kernel threads) to be Enables a system-wide task dump (excluding kernel threads) to be
produced when the kernel performs an OOM-killing and includes such produced when the kernel performs an OOM-killing and includes such
information as pid, uid, tgid, vm size, rss, cpu, oom_adj score, and information as pid, uid, tgid, vm size, rss, nr_ptes, swapents,
name. This is helpful to determine why the OOM killer was invoked oom_score_adj score, and name. This is helpful to determine why the
and to identify the rogue task that caused it. OOM killer was invoked, to identify the rogue task that caused it,
and to determine why the OOM killer chose the task it did to kill.
If this is set to zero, this information is suppressed. On very If this is set to zero, this information is suppressed. On very
large systems with thousands of tasks it may not be feasible to dump large systems with thousands of tasks it may not be feasible to dump
......
...@@ -371,8 +371,8 @@ static struct task_struct *select_bad_process(unsigned int *ppoints, ...@@ -371,8 +371,8 @@ static struct task_struct *select_bad_process(unsigned int *ppoints,
* Dumps the current memory state of all eligible tasks. Tasks not in the same * Dumps the current memory state of all eligible tasks. Tasks not in the same
* memcg, not in the same cpuset, or bound to a disjoint set of mempolicy nodes * memcg, not in the same cpuset, or bound to a disjoint set of mempolicy nodes
* are not shown. * are not shown.
* State information includes task's pid, uid, tgid, vm size, rss, cpu, oom_adj * State information includes task's pid, uid, tgid, vm size, rss, nr_ptes,
* value, oom_score_adj value, and name. * swapents, oom_score_adj value, and name.
* *
* Call with tasklist_lock read-locked. * Call with tasklist_lock read-locked.
*/ */
...@@ -381,7 +381,7 @@ static void dump_tasks(const struct mem_cgroup *memcg, const nodemask_t *nodemas ...@@ -381,7 +381,7 @@ static void dump_tasks(const struct mem_cgroup *memcg, const nodemask_t *nodemas
struct task_struct *p; struct task_struct *p;
struct task_struct *task; struct task_struct *task;
pr_info("[ pid ] uid tgid total_vm rss cpu oom_adj oom_score_adj name\n"); pr_info("[ pid ] uid tgid total_vm rss nr_ptes swapents oom_score_adj name\n");
for_each_process(p) { for_each_process(p) {
if (oom_unkillable_task(p, memcg, nodemask)) if (oom_unkillable_task(p, memcg, nodemask))
continue; continue;
...@@ -396,10 +396,11 @@ static void dump_tasks(const struct mem_cgroup *memcg, const nodemask_t *nodemas ...@@ -396,10 +396,11 @@ static void dump_tasks(const struct mem_cgroup *memcg, const nodemask_t *nodemas
continue; continue;
} }
pr_info("[%5d] %5d %5d %8lu %8lu %3u %3d %5d %s\n", pr_info("[%5d] %5d %5d %8lu %8lu %7lu %8lu %5d %s\n",
task->pid, from_kuid(&init_user_ns, task_uid(task)), task->pid, from_kuid(&init_user_ns, task_uid(task)),
task->tgid, task->mm->total_vm, get_mm_rss(task->mm), task->tgid, task->mm->total_vm, get_mm_rss(task->mm),
task_cpu(task), task->signal->oom_adj, task->mm->nr_ptes,
get_mm_counter(task->mm, MM_SWAPENTS),
task->signal->oom_score_adj, task->comm); task->signal->oom_score_adj, task->comm);
task_unlock(task); task_unlock(task);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment