android, lmk: Send SIGKILL before setting TIF_MEMDIE.
It was observed that setting TIF_MEMDIE before sending SIGKILL at
oom_kill_process() allows memory reserves to be depleted by allocations
which are not needed for terminating the OOM victim.
This patch reverts commit 6bc2b856bb
("staging: android: lowmemorykiller:
set TIF_MEMDIE before send kill sig"), for oom_kill_process() was updated
to send SIGKILL before setting TIF_MEMDIE.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5cc95cd81b
commit
3a81fc20ea
|
@ -157,26 +157,22 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc)
|
||||||
}
|
}
|
||||||
if (selected) {
|
if (selected) {
|
||||||
task_lock(selected);
|
task_lock(selected);
|
||||||
if (!selected->mm) {
|
send_sig(SIGKILL, selected, 0);
|
||||||
/* Already exited, cannot do mark_tsk_oom_victim() */
|
|
||||||
task_unlock(selected);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* FIXME: lowmemorykiller shouldn't abuse global OOM killer
|
* FIXME: lowmemorykiller shouldn't abuse global OOM killer
|
||||||
* infrastructure. There is no real reason why the selected
|
* infrastructure. There is no real reason why the selected
|
||||||
* task should have access to the memory reserves.
|
* task should have access to the memory reserves.
|
||||||
*/
|
*/
|
||||||
mark_oom_victim(selected);
|
if (selected->mm)
|
||||||
|
mark_oom_victim(selected);
|
||||||
task_unlock(selected);
|
task_unlock(selected);
|
||||||
lowmem_print(1, "send sigkill to %d (%s), adj %hd, size %d\n",
|
lowmem_print(1, "send sigkill to %d (%s), adj %hd, size %d\n",
|
||||||
selected->pid, selected->comm,
|
selected->pid, selected->comm,
|
||||||
selected_oom_score_adj, selected_tasksize);
|
selected_oom_score_adj, selected_tasksize);
|
||||||
lowmem_deathpending_timeout = jiffies + HZ;
|
lowmem_deathpending_timeout = jiffies + HZ;
|
||||||
send_sig(SIGKILL, selected, 0);
|
|
||||||
rem += selected_tasksize;
|
rem += selected_tasksize;
|
||||||
}
|
}
|
||||||
out:
|
|
||||||
lowmem_print(4, "lowmem_scan %lu, %x, return %lu\n",
|
lowmem_print(4, "lowmem_scan %lu, %x, return %lu\n",
|
||||||
sc->nr_to_scan, sc->gfp_mask, rem);
|
sc->nr_to_scan, sc->gfp_mask, rem);
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
Loading…
Reference in New Issue