Revert "ANDROID: mm: oom_kill: reap memory of a task that receives SIGKILL"

This reverts commit a7af91adc7 ("ANDROID: mm: oom_kill: reap memory of
a task that receives SIGKILL") as this functionality is moved to vendor
hook based approach.

Bug: 189803002
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
Change-Id: Ica0d6df22fb81bf430e9b4c7d12b36ab7d44dab8
This commit is contained in:
Charan Teja Reddy
2021-06-03 10:46:49 +05:30
committed by Suren Baghdasaryan
parent 4794cb419d
commit 3f491d10dc
4 changed files with 7 additions and 55 deletions

View File

@@ -724,20 +724,6 @@ static inline void wake_oom_reaper(struct task_struct *tsk)
}
#endif /* CONFIG_MMU */
/**
* tsk->mm has to be non NULL and caller has to guarantee it is stable (either
* under task_lock or operate on the current).
*/
static void __mark_oom_victim(struct task_struct *tsk)
{
struct mm_struct *mm = tsk->mm;
if (!cmpxchg(&tsk->signal->oom_mm, NULL, mm)) {
mmgrab(tsk->signal->oom_mm);
set_bit(MMF_OOM_VICTIM, &mm->flags);
}
}
/**
* mark_oom_victim - mark the given task as OOM victim
* @tsk: task to mark
@@ -750,13 +736,18 @@ static void __mark_oom_victim(struct task_struct *tsk)
*/
static void mark_oom_victim(struct task_struct *tsk)
{
struct mm_struct *mm = tsk->mm;
WARN_ON(oom_killer_disabled);
/* OOM killer might race with memcg OOM */
if (test_and_set_tsk_thread_flag(tsk, TIF_MEMDIE))
return;
/* oom_mm is bound to the signal struct life time. */
__mark_oom_victim(tsk);
if (!cmpxchg(&tsk->signal->oom_mm, NULL, mm)) {
mmgrab(tsk->signal->oom_mm);
set_bit(MMF_OOM_VICTIM, &mm->flags);
}
/*
* Make sure that the task is woken up from uninterruptible sleep
@@ -1194,18 +1185,3 @@ void pagefault_out_of_memory(void)
out_of_memory(&oc);
mutex_unlock(&oom_lock);
}
void add_to_oom_reaper(struct task_struct *p)
{
p = find_lock_task_mm(p);
if (!p)
return;
get_task_struct(p);
if (task_will_free_mem(p)) {
__mark_oom_victim(p);
wake_oom_reaper(p);
}
task_unlock(p);
put_task_struct(p);
}