Skip to content

Commit

Permalink
oom: move constraints to enum
Browse files Browse the repository at this point in the history
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: Christoph Lameter <clameter@sgi.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
David Rientjes authored and Linus Torvalds committed Oct 17, 2007
1 parent 5a3135c commit 70e24bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
9 changes: 9 additions & 0 deletions include/linux/oom.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@

#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 int register_oom_notifier(struct notifier_block *nb);
extern int unregister_oom_notifier(struct notifier_block *nb);
Expand Down
12 changes: 3 additions & 9 deletions mm/oom_kill.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,11 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
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.
*/
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
struct zone **z;
Expand Down Expand Up @@ -393,7 +387,7 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order)
struct task_struct *p;
unsigned long points = 0;
unsigned long freed = 0;
int constraint;
enum oom_constraint constraint;

blocking_notifier_call_chain(&oom_notify_list, 0, &freed);
if (freed > 0)
Expand Down

0 comments on commit 70e24bd

Please sign in to comment.