Skip to content

Commit c81fac5

Browse files
rientjestorvalds
authored andcommitted
oom: dump_tasks use find_lock_task_mm too fix
When find_lock_task_mm() returns a thread other than p in dump_tasks(), its name should be displayed instead. This is the thread that will be targeted by the oom killer, not its mm-less parent. This also allows us to safely dereference task->comm without needing get_task_comm(). While we're here, remove the cast on task_cpu(task) as Andrew suggested. Signed-off-by: David Rientjes <[email protected]> Cc: KOSAKI Motohiro <[email protected]> Cc: Balbir Singh <[email protected]> Cc: Oleg Nesterov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 74ab7f1 commit c81fac5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mm/oom_kill.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,10 +357,10 @@ static void dump_tasks(const struct mem_cgroup *mem)
357357
continue;
358358
}
359359

360-
printk(KERN_INFO "[%5d] %5d %5d %8lu %8lu %3d %3d %s\n",
360+
printk(KERN_INFO "[%5d] %5d %5d %8lu %8lu %3u %3d %s\n",
361361
task->pid, __task_cred(task)->uid, task->tgid,
362362
task->mm->total_vm, get_mm_rss(task->mm),
363-
(int)task_cpu(task), task->signal->oom_adj, p->comm);
363+
task_cpu(task), task->signal->oom_adj, task->comm);
364364
task_unlock(task);
365365
}
366366
}

0 commit comments

Comments
 (0)