Re: [RFC PATCH] oom: Don't count on mm-less current process.

Tetsuo Handa
2014-12-23T12:52:30Z

Tetsuo Handa wrote:
> If such a delay is theoretically impossible, I'm OK with your patch.
>

Oops, I forgot to mention that task_unlock(p) should be called before
put_task_struct(p), in case p->usage == 1 at put_task_struct(p).

* If the task is already exiting, don't alarm the sysadmin or kill
* its children or threads, just set TIF_MEMDIE so it can die quickly
*/
- if (task_will_free_mem(p)) {
+ task_lock(p);
+ if (p->mm && task_will_free_mem(p)) {
set_tsk_thread_flag(p, TIF_MEMDIE);
put_task_struct(p);
+ task_unlock(p);
return;
}
+ task_unlock(p);

if (__ratelimit(&oom_rs))
dump_header(p, gfp_mask, order, memcg, nodemask);