[PATCH] OOM killer meets userspace headers
Despite mm.h is not being exported header, it does contain one thing which is part of userspace ABI -- value disabling OOM killer for given process. So, a) create and export include/linux/oom.h b) move OOM_DISABLE define there. c) turn bounding values of /proc/$PID/oom_adj into defines and export them too. Note: mass __KERNEL__ removal will be done later. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Christoph Hellwig <hch@infradead.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
887b95931b
commit
8ac773b4f7
|
@ -72,6 +72,7 @@
|
||||||
#include <linux/audit.h>
|
#include <linux/audit.h>
|
||||||
#include <linux/poll.h>
|
#include <linux/poll.h>
|
||||||
#include <linux/nsproxy.h>
|
#include <linux/nsproxy.h>
|
||||||
|
#include <linux/oom.h>
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
/* NOTE:
|
/* NOTE:
|
||||||
|
@ -689,7 +690,8 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
|
||||||
if (copy_from_user(buffer, buf, count))
|
if (copy_from_user(buffer, buf, count))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
oom_adjust = simple_strtol(buffer, &end, 0);
|
oom_adjust = simple_strtol(buffer, &end, 0);
|
||||||
if ((oom_adjust < -16 || oom_adjust > 15) && oom_adjust != OOM_DISABLE)
|
if ((oom_adjust < OOM_ADJUST_MIN || oom_adjust > OOM_ADJUST_MAX) &&
|
||||||
|
oom_adjust != OOM_DISABLE)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (*end == '\n')
|
if (*end == '\n')
|
||||||
end++;
|
end++;
|
||||||
|
|
|
@ -120,6 +120,7 @@ header-y += netrom.h
|
||||||
header-y += nfs2.h
|
header-y += nfs2.h
|
||||||
header-y += nfs4_mount.h
|
header-y += nfs4_mount.h
|
||||||
header-y += nfs_mount.h
|
header-y += nfs_mount.h
|
||||||
|
header-y += oom.h
|
||||||
header-y += param.h
|
header-y += param.h
|
||||||
header-y += pci_ids.h
|
header-y += pci_ids.h
|
||||||
header-y += pci_regs.h
|
header-y += pci_regs.h
|
||||||
|
|
|
@ -1115,9 +1115,6 @@ int in_gate_area_no_task(unsigned long addr);
|
||||||
#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);})
|
#define in_gate_area(task, addr) ({(void)task; in_gate_area_no_task(addr);})
|
||||||
#endif /* __HAVE_ARCH_GATE_AREA */
|
#endif /* __HAVE_ARCH_GATE_AREA */
|
||||||
|
|
||||||
/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */
|
|
||||||
#define OOM_DISABLE -17
|
|
||||||
|
|
||||||
int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *,
|
int drop_caches_sysctl_handler(struct ctl_table *, int, struct file *,
|
||||||
void __user *, size_t *, loff_t *);
|
void __user *, size_t *, loff_t *);
|
||||||
unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
|
unsigned long shrink_slab(unsigned long scanned, gfp_t gfp_mask,
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
#ifndef __INCLUDE_LINUX_OOM_H
|
||||||
|
#define __INCLUDE_LINUX_OOM_H
|
||||||
|
|
||||||
|
/* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */
|
||||||
|
#define OOM_DISABLE (-17)
|
||||||
|
/* inclusive */
|
||||||
|
#define OOM_ADJUST_MIN (-16)
|
||||||
|
#define OOM_ADJUST_MAX 15
|
||||||
|
|
||||||
|
#endif
|
|
@ -15,6 +15,7 @@
|
||||||
* kernel subsystems and hints as to where to find out what things do.
|
* kernel subsystems and hints as to where to find out what things do.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/oom.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#include <linux/swap.h>
|
#include <linux/swap.h>
|
||||||
|
|
Loading…
Reference in New Issue