Blame view

include/linux/oom.h 1.88 KB
8ac773b4f   Alexey Dobriyan   [PATCH] OOM kille...
1
2
  #ifndef __INCLUDE_LINUX_OOM_H
  #define __INCLUDE_LINUX_OOM_H
a63d83f42   David Rientjes   oom: badness heur...
3
  /*
51b1bd2ac   David Rientjes   oom: deprecate oo...
4
5
6
   * /proc/<pid>/oom_adj is deprecated, see
   * Documentation/feature-removal-schedule.txt.
   *
a63d83f42   David Rientjes   oom: badness heur...
7
8
   * /proc/<pid>/oom_adj set to -17 protects from the oom-killer
   */
8ac773b4f   Alexey Dobriyan   [PATCH] OOM kille...
9
10
11
12
  #define OOM_DISABLE (-17)
  /* inclusive */
  #define OOM_ADJUST_MIN (-16)
  #define OOM_ADJUST_MAX 15
a63d83f42   David Rientjes   oom: badness heur...
13
14
15
16
17
18
  /*
   * /proc/<pid>/oom_score_adj set to OOM_SCORE_ADJ_MIN disables oom killing for
   * pid.
   */
  #define OOM_SCORE_ADJ_MIN	(-1000)
  #define OOM_SCORE_ADJ_MAX	1000
5a3135c2e   David Rientjes   oom: move prototy...
19
  #ifdef __KERNEL__
a63d83f42   David Rientjes   oom: badness heur...
20
  #include <linux/sched.h>
172acf60f   David Rientjes   oom: prevent incl...
21
  #include <linux/types.h>
4365a5676   KAMEZAWA Hiroyuki   oom-kill: fix NUM...
22
  #include <linux/nodemask.h>
172acf60f   David Rientjes   oom: prevent incl...
23
24
25
  
  struct zonelist;
  struct notifier_block;
74bcbf405   Andrew Morton   oom: move badness...
26
27
  struct mem_cgroup;
  struct task_struct;
172acf60f   David Rientjes   oom: prevent incl...
28

70e24bdf6   David Rientjes   oom: move constra...
29
30
31
32
33
34
35
  /*
   * Types of limitations to the nodes from which allocations may occur
   */
  enum oom_constraint {
  	CONSTRAINT_NONE,
  	CONSTRAINT_CPUSET,
  	CONSTRAINT_MEMORY_POLICY,
309ed8825   David Rientjes   oom: extract pani...
36
  	CONSTRAINT_MEMCG,
70e24bdf6   David Rientjes   oom: move constra...
37
  };
43362a497   David Rientjes   oom: fix race whi...
38
  extern void compare_swap_oom_score_adj(int old_val, int new_val);
72788c385   David Rientjes   oom: replace PF_O...
39
  extern int test_set_oom_score_adj(int new_val);
72835c86c   Johannes Weiner   mm: unify remaini...
40
  extern unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *memcg,
a63d83f42   David Rientjes   oom: badness heur...
41
  			const nodemask_t *nodemask, unsigned long totalpages);
ff321feac   Minchan Kim   mm: rename try_se...
42
  extern int try_set_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
dd1a239f6   Mel Gorman   mm: have zonelist...
43
  extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
098d7f128   David Rientjes   oom: add per-zone...
44

4365a5676   KAMEZAWA Hiroyuki   oom-kill: fix NUM...
45
46
  extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
  		int order, nodemask_t *mask);
5a3135c2e   David Rientjes   oom: move prototy...
47
48
  extern int register_oom_notifier(struct notifier_block *nb);
  extern int unregister_oom_notifier(struct notifier_block *nb);
1a8670a29   Alexey Dobriyan   oom: move oom_kil...
49
50
51
52
53
54
55
56
57
58
59
  extern bool oom_killer_disabled;
  
  static inline void oom_killer_disable(void)
  {
  	oom_killer_disabled = true;
  }
  
  static inline void oom_killer_enable(void)
  {
  	oom_killer_disabled = false;
  }
8e4228e1e   David Rientjes   oom: move sysctl ...
60

158e0a2d1   KAMEZAWA Hiroyuki   memcg: use find_l...
61
  extern struct task_struct *find_lock_task_mm(struct task_struct *p);
8e4228e1e   David Rientjes   oom: move sysctl ...
62
63
64
65
  /* sysctls */
  extern int sysctl_oom_dump_tasks;
  extern int sysctl_oom_kill_allocating_task;
  extern int sysctl_panic_on_oom;
5a3135c2e   David Rientjes   oom: move prototy...
66
67
  #endif /* __KERNEL__*/
  #endif /* _INCLUDE_LINUX_OOM_H */