mm: Adjust tsk_is_oom_victim() for Simple LMK

The page allocator uses tsk_is_oom_victim() to determine when to
fast-path memory allocations in order to get an allocating process out
of the page allocator and into do_exit() quickly. Unfortunately,
tsk_is_oom_victim()'s check to see if a process is killed for OOM
purposes is to look for the presence of an OOM reaper artifact that only
the OOM killer sets. This means that for processes killed by Simple LMK,
there is no fast-pathing done in the page allocator to get them to die
faster.

Remedy this by changing tsk_is_oom_victim() to look for the existence of
the TIF_MEMDIE flag, which Simple LMK sets for its victims.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
fourteen
Sultan Alsawaf 5 years ago committed by Jenna
parent db3710af8b
commit b4a1ee655f
  1. 4
      include/linux/oom.h

@ -63,7 +63,11 @@ static inline bool oom_task_origin(const struct task_struct *p)
static inline bool tsk_is_oom_victim(struct task_struct * tsk)
{
#ifdef CONFIG_ANDROID_SIMPLE_LMK
return test_ti_thread_flag(task_thread_info(tsk), TIF_MEMDIE);
#else
return tsk->signal->oom_mm;
#endif
}
/*

Loading…
Cancel
Save