linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Andrea Arcangeli <andrea@suse.de>,
	Christoph Lameter <clameter@sgi.com>,
	Rik van Riel <riel@redhat.com>,
	linux-mm@kvack.org
Subject: [patch 2/9] oom: move constraints to enum
Date: Thu, 20 Sep 2007 13:23:16 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.0.9999.0709201319520.25753@chino.kir.corp.google.com> (raw)
In-Reply-To: <alpine.DEB.0.9999.0709201319300.25753@chino.kir.corp.google.com>

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>
---
 include/linux/oom.h |    9 +++++++++
 mm/oom_kill.c       |   12 +++---------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/include/linux/oom.h b/include/linux/oom.h
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -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);
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -164,16 +164,10 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
 }
 
 /*
- * 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;
@@ -400,7 +394,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)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2007-09-20 20:23 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-20 20:23 [patch 0/9] oom killer serialization David Rientjes
2007-09-20 20:23 ` [patch 1/9] oom: move prototypes to appropriate header file David Rientjes
2007-09-20 20:23   ` David Rientjes [this message]
2007-09-20 20:23     ` [patch 3/9] oom: change all_unreclaimable zone member to flags David Rientjes
2007-09-20 20:23       ` [patch 4/9] oom: add per-zone locking David Rientjes
2007-09-20 20:23         ` [patch 5/9] oom: serialize out of memory calls David Rientjes
2007-09-20 20:23           ` [patch 6/9] oom: add oom_kill_asking_task sysctl David Rientjes
2007-09-20 20:23             ` [patch 7/9] oom: suppress extraneous stack and memory dump David Rientjes
2007-09-20 20:23               ` [patch 8/9] oom: compare cpuset mems_allowed instead of exclusive ancestors David Rientjes
2007-09-20 20:23                 ` [patch 9/9] oom: do not take callback_mutex David Rientjes
2007-09-20 22:04                   ` Christoph Lameter
2007-09-20 22:01                 ` [patch 8/9] oom: compare cpuset mems_allowed instead of exclusive ancestors Christoph Lameter
2007-09-20 22:00               ` [patch 7/9] oom: suppress extraneous stack and memory dump Christoph Lameter
2007-09-20 22:03             ` [patch 6/9] oom: add oom_kill_asking_task sysctl Christoph Lameter
2007-09-20 22:07               ` David Rientjes
2007-09-20 22:09                 ` Christoph Lameter
2007-09-21  9:05             ` Andrew Morton
2007-09-20 21:59           ` [patch 5/9] oom: serialize out of memory calls Christoph Lameter
2007-09-21  9:01           ` Andrew Morton
2007-09-21 20:04             ` David Rientjes
2007-09-20 21:59         ` [patch 4/9] oom: add per-zone locking Christoph Lameter
2007-09-20 22:03           ` David Rientjes
2007-09-20 22:05             ` Christoph Lameter
2007-09-20 22:12               ` David Rientjes
2007-09-20 22:26                 ` Christoph Lameter
2007-09-20 22:48                   ` David Rientjes
2007-09-21  8:59                     ` Andrew Morton
2007-09-20 21:56       ` [patch 3/9] oom: change all_unreclaimable zone member to flags Christoph Lameter
2007-09-20 21:58         ` David Rientjes
2007-09-21  8:55       ` Andrew Morton
2007-09-21  9:12 ` [patch 0/9] oom killer serialization Andrew Morton
2007-09-21  9:21   ` David Rientjes
2007-09-21 19:13     ` David Rientjes
2007-09-21 19:15   ` Christoph Lameter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.0.9999.0709201319520.25753@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrea@suse.de \
    --cc=clameter@sgi.com \
    --cc=linux-mm@kvack.org \
    --cc=riel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox