From b4a1ee655f8f97a0e1c2da181f48aa8024bd06de Mon Sep 17 00:00:00 2001 From: Sultan Alsawaf Date: Thu, 26 Mar 2020 21:42:01 -0700 Subject: [PATCH] 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 --- include/linux/oom.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/oom.h b/include/linux/oom.h index 395ac25d0cfc..3f1b8caab914 100755 --- a/include/linux/oom.h +++ b/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 } /*