summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorQiang Huang <h.huangqiang@huawei.com>2013-11-12 15:07:22 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 12:09:04 +0900
commitb9921ecdee66984b00c38c00a358ef3f611d2b50 (patch)
treecaf420f152f6c8764f150ad336645deec9acaeb2 /include/linux
parent9c2606b77d6bffb422928bca66c8dc84d85089be (diff)
mm: add a helper function to check may oom condition
Use helper function to check if we need to deal with oom condition. Signed-off-by: Qiang Huang <h.huangqiang@huawei.com> Acked-by: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/oom.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/oom.h b/include/linux/oom.h
index da60007075b..4cd62677feb 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -82,6 +82,11 @@ static inline void oom_killer_enable(void)
oom_killer_disabled = false;
}
+static inline bool oom_gfp_allowed(gfp_t gfp_mask)
+{
+ return (gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY);
+}
+
extern struct task_struct *find_lock_task_mm(struct task_struct *p);
/* sysctls */