mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
memcg: use find_lock_task_mm() in memory cgroups oom
When the OOM killer scans task, it check a task is under memcg or not when it's called via memcg's context. But, as Oleg pointed out, a thread group leader may have NULL ->mm and task_in_mem_cgroup() may do wrong decision. We have to use find_lock_task_mm() in memcg as generic OOM-Killer does. Signed-off-by: KAMEZAWA Hiroyuki <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Daisuke Nishimura <[email protected]> Cc: Balbir Singh <[email protected]> Reviewed-by: Minchan Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
73045c47b6
commit
158e0a2d1b
3 changed files with 10 additions and 4 deletions
|
|
@ -47,6 +47,7 @@
|
|||
#include <linux/mm_inline.h>
|
||||
#include <linux/page_cgroup.h>
|
||||
#include <linux/cpu.h>
|
||||
#include <linux/oom.h>
|
||||
#include "internal.h"
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
|
|
@ -838,10 +839,13 @@ int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem)
|
|||
{
|
||||
int ret;
|
||||
struct mem_cgroup *curr = NULL;
|
||||
struct task_struct *p;
|
||||
|
||||
task_lock(task);
|
||||
curr = try_get_mem_cgroup_from_mm(task->mm);
|
||||
task_unlock(task);
|
||||
p = find_lock_task_mm(task);
|
||||
if (!p)
|
||||
return 0;
|
||||
curr = try_get_mem_cgroup_from_mm(p->mm);
|
||||
task_unlock(p);
|
||||
if (!curr)
|
||||
return 0;
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue