提交 70e24bdf 编写于 作者: D David Rientjes 提交者: Linus Torvalds

oom: move constraints to enum

The OOM killer's CONSTRAINT definitions are really more appropriate in an
enum, so define them in include/linux/oom.h.

Cc: Andrea Arcangeli <andrea@suse.de>
Acked-by: NChristoph Lameter <clameter@sgi.com>
Signed-off-by: NDavid Rientjes <rientjes@google.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 5a3135c2
...@@ -11,6 +11,15 @@ ...@@ -11,6 +11,15 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
/*
* Types of limitations to the nodes from which allocations may occur
*/
enum oom_constraint {
CONSTRAINT_NONE,
CONSTRAINT_CPUSET,
CONSTRAINT_MEMORY_POLICY,
};
extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order); extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order);
extern int register_oom_notifier(struct notifier_block *nb); extern int register_oom_notifier(struct notifier_block *nb);
extern int unregister_oom_notifier(struct notifier_block *nb); extern int unregister_oom_notifier(struct notifier_block *nb);
......
...@@ -163,17 +163,11 @@ unsigned long badness(struct task_struct *p, unsigned long uptime) ...@@ -163,17 +163,11 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
return points; return points;
} }
/*
* Types of limitations to the nodes from which allocations may occur
*/
#define CONSTRAINT_NONE 1
#define CONSTRAINT_MEMORY_POLICY 2
#define CONSTRAINT_CPUSET 3
/* /*
* Determine the type of allocation constraint. * Determine the type of allocation constraint.
*/ */
static inline int constrained_alloc(struct zonelist *zonelist, gfp_t gfp_mask) static inline enum oom_constraint constrained_alloc(struct zonelist *zonelist,
gfp_t gfp_mask)
{ {
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
struct zone **z; struct zone **z;
...@@ -393,7 +387,7 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order) ...@@ -393,7 +387,7 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order)
struct task_struct *p; struct task_struct *p;
unsigned long points = 0; unsigned long points = 0;
unsigned long freed = 0; unsigned long freed = 0;
int constraint; enum oom_constraint constraint;
blocking_notifier_call_chain(&oom_notify_list, 0, &freed); blocking_notifier_call_chain(&oom_notify_list, 0, &freed);
if (freed > 0) if (freed > 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册