diff options
-rw-r--r-- | fs/proc/base.c | 4 | ||||
-rw-r--r-- | include/linux/Kbuild | 1 | ||||
-rw-r--r-- | include/linux/mm.h | 3 | ||||
-rw-r--r-- | include/linux/oom.h | 10 | ||||
-rw-r--r-- | mm/oom_kill.c | 1 |
5 files changed, 15 insertions, 4 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 26a8f8416b79..8df27401d292 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -72,6 +72,7 @@ | |||
72 | #include <linux/audit.h> | 72 | #include <linux/audit.h> |
73 | #include <linux/poll.h> | 73 | #include <linux/poll.h> |
74 | #include <linux/nsproxy.h> | 74 | #include <linux/nsproxy.h> |
75 | #include <linux/oom.h> | ||
75 | #include "internal.h" | 76 | #include "internal.h" |
76 | 77 | ||
77 | /* NOTE: | 78 | /* NOTE: |
@@ -689,7 +690,8 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf, | |||
689 | if (copy_from_user(buffer, buf, count)) | 690 | if (copy_from_user(buffer, buf, count)) |
690 | return -EFAULT; | 691 | return -EFAULT; |
691 | oom_adjust = simple_strtol(buffer, &end, 0); | 692 | oom_adjust = simple_strtol(buffer, &end, 0); |
692 | if ((oom_adjust < -16 || oom_adjust > 15) && oom_adjust != OOM_DISABLE) | 693 | if ((oom_adjust < OOM_ADJUST_MIN || oom_adjust > OOM_ADJUST_MAX) && |
694 | oom_adjust != OOM_DISABLE) | ||
693 | return -EINVAL; | 695 | return -EINVAL; |
694 | if (*end == '\n') | 696 | if (*end == '\n') |
695 | end++; | 697 | end++; |
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 5114ff18101d..a1155a2beb32 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -120,6 +120,7 @@ header-y += netrom.h | |||
120 | header-y += nfs2.h | 120 | header-y += nfs2.h |
121 | header-y += nfs4_mount.h | 121 | header-y += nfs4_mount.h |
122 | header-y += nfs_mount.h | 122 | header-y += nfs_mount.h |
123 | header-y += oom.h | ||
123 | header-y += param.h | 124 | header-y += param.h |
124 | header-y += pci_ids.h | 125 | header-y += pci_ids.h |
125 | header-y += pci_regs.h | 126 | header-y += pci_regs.h |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 5a6068ff5556..d538de901965 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1115,9 +1115,6 @@ int in_gate_area_no_task(unsigned long addr); | |||
1115 | #define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);}) | 1115 | #define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);}) |
1116 | #endif /* __HAVE_ARCH_GATE_AREA */ | 1116 | #endif /* __HAVE_ARCH_GATE_AREA */ |
1117 | 1117 | ||
1118 | /* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */ | ||
1119 | #define OOM_DISABLE -17 | ||
1120 | |||
1121 | int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *, | 1118 | int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *, |
1122 | void __user *, size_t *, loff_t *); | 1119 | void __user *, size_t *, loff_t *); |
1123 | unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask, | 1120 | unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask, |
diff --git a/include/linux/oom.h b/include/linux/oom.h new file mode 100644 index 000000000000..ad76463629a0 --- /dev/null +++ b/include/linux/oom.h | |||
@@ -0,0 +1,10 @@ | |||
1 | #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 | |||
10 | #endif | ||
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 20f41b082e16..2e3ce3a928b9 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -15,6 +15,7 @@ | |||
15 | * kernel subsystems and hints as to where to find out what things do. | 15 | * kernel subsystems and hints as to where to find out what things do. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/oom.h> | ||
18 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
19 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
20 | #include <linux/swap.h> | 21 | #include <linux/swap.h> |