blob: 3ae6d94d05403a4fe7779aed6137a248a86dc14d [file] [log] [blame]
Alexey Dobriyan8ac773b2006-10-19 23:28:32 -07001#ifndef __INCLUDE_LINUX_OOM_H
2#define __INCLUDE_LINUX_OOM_H
3
4/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */
5#define OOM_DISABLE (-17)
6/* inclusive */
7#define OOM_ADJUST_MIN (-16)
8#define OOM_ADJUST_MAX 15
9
David Rientjes5a3135c2007-10-16 23:25:53 -070010#ifdef __KERNEL__
11
David Rientjes172acf62007-10-16 23:25:59 -070012#include <linux/types.h>
KAMEZAWA Hiroyuki4365a562009-12-15 16:45:33 -080013#include <linux/nodemask.h>
David Rientjes172acf62007-10-16 23:25:59 -070014
15struct zonelist;
16struct notifier_block;
17
David Rientjes70e24bd2007-10-16 23:25:53 -070018/*
19 * Types of limitations to the nodes from which allocations may occur
20 */
21enum oom_constraint {
22 CONSTRAINT_NONE,
23 CONSTRAINT_CPUSET,
24 CONSTRAINT_MEMORY_POLICY,
David Rientjes309ed882010-08-09 17:18:54 -070025 CONSTRAINT_MEMCG,
David Rientjes70e24bd2007-10-16 23:25:53 -070026};
27
Mel Gormandd1a2392008-04-28 02:12:17 -070028extern int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_flags);
29extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
David Rientjes098d7f12007-10-16 23:25:55 -070030
KAMEZAWA Hiroyuki4365a562009-12-15 16:45:33 -080031extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
32 int order, nodemask_t *mask);
David Rientjes5a3135c2007-10-16 23:25:53 -070033extern int register_oom_notifier(struct notifier_block *nb);
34extern int unregister_oom_notifier(struct notifier_block *nb);
35
Alexey Dobriyan1a8670a2009-09-21 17:03:09 -070036extern bool oom_killer_disabled;
37
38static inline void oom_killer_disable(void)
39{
40 oom_killer_disabled = true;
41}
42
43static inline void oom_killer_enable(void)
44{
45 oom_killer_disabled = false;
46}
David Rientjes5a3135c2007-10-16 23:25:53 -070047#endif /* __KERNEL__*/
48#endif /* _INCLUDE_LINUX_OOM_H */