blob: 6aac5fe4f6f120db2b2c9b5199d69e7d820d5856 [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 Rientjes5a3135c22007-10-16 23:25:53 -070010#ifdef __KERNEL__
11
David Rientjes172acf62007-10-16 23:25:59 -070012#include <linux/types.h>
13
14struct zonelist;
15struct notifier_block;
16
David Rientjes70e24bd2007-10-16 23:25:53 -070017/*
18 * Types of limitations to the nodes from which allocations may occur
19 */
20enum oom_constraint {
21 CONSTRAINT_NONE,
22 CONSTRAINT_CPUSET,
23 CONSTRAINT_MEMORY_POLICY,
24};
25
Mel Gormandd1a2392008-04-28 02:12:17 -070026extern int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_flags);
27extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
David Rientjes098d7f12007-10-16 23:25:55 -070028
David Rientjes5a3135c22007-10-16 23:25:53 -070029extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order);
30extern int register_oom_notifier(struct notifier_block *nb);
31extern int unregister_oom_notifier(struct notifier_block *nb);
32
Alexey Dobriyan1a8670a2009-09-21 17:03:09 -070033extern bool oom_killer_disabled;
34
35static inline void oom_killer_disable(void)
36{
37 oom_killer_disabled = true;
38}
39
40static inline void oom_killer_enable(void)
41{
42 oom_killer_disabled = false;
43}
David Rientjes5a3135c22007-10-16 23:25:53 -070044#endif /* __KERNEL__*/
45#endif /* _INCLUDE_LINUX_OOM_H */