Merge tag 'irqchip-urgent-3.19' of git://git.infradead.org/users/jcooper/linux into...
[firefly-linux-kernel-4.4.55.git] / include / linux / oom.h
index e8d6e10587233466c666d6be2e3fb21603a82552..853698c721f7d1547df181a4fbfc904a67758f72 100644 (file)
@@ -92,6 +92,17 @@ static inline bool oom_gfp_allowed(gfp_t gfp_mask)
 
 extern struct task_struct *find_lock_task_mm(struct task_struct *p);
 
+static inline bool task_will_free_mem(struct task_struct *task)
+{
+       /*
+        * A coredumping process may sleep for an extended period in exit_mm(),
+        * so the oom killer cannot assume that the process will promptly exit
+        * and release memory.
+        */
+       return (task->flags & PF_EXITING) &&
+               !(task->signal->flags & SIGNAL_GROUP_COREDUMP);
+}
+
 /* sysctls */
 extern int sysctl_oom_dump_tasks;
 extern int sysctl_oom_kill_allocating_task;