linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/3] mm, oom: ensure memoryless node zonelist always includes zones
@ 2014-07-24  1:16 David Rientjes
  2014-07-24  1:16 ` [patch 2/3] mm, oom: remove unnecessary check for NULL zonelist David Rientjes
  2014-07-24  1:16 ` [patch 3/3] mm, oom: rename zonelist locking functions David Rientjes
  0 siblings, 2 replies; 9+ messages in thread
From: David Rientjes @ 2014-07-24  1:16 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Kirill A. Shutemov, Johannes Weiner, Rik van Riel, linux-kernel,
	linux-mm

With memoryless node support being worked on, it's possible that for 
optimizations that a node may not have a non-NULL zonelist.  When CONFIG_NUMA is 
enabled and node 0 is memoryless, this means the zonelist for first_online_node 
may become NULL.

The oom killer requires a zonelist that includes all memory zones for the sysrq 
trigger and pagefault out of memory handler.

Ensure that a non-NULL zonelist is always passed to the oom killer.

Signed-off-by: David Rientjes <rientjes@google.com>
---
 drivers/tty/sysrq.c      |  2 +-
 include/linux/nodemask.h | 10 +++++++++-
 mm/oom_kill.c            |  2 +-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -355,7 +355,7 @@ static struct sysrq_key_op sysrq_term_op = {
 
 static void moom_callback(struct work_struct *ignored)
 {
-	out_of_memory(node_zonelist(first_online_node, GFP_KERNEL), GFP_KERNEL,
+	out_of_memory(node_zonelist(first_memory_node, GFP_KERNEL), GFP_KERNEL,
 		      0, NULL, true);
 }
 
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -430,7 +430,15 @@ static inline int num_node_state(enum node_states state)
 	for_each_node_mask((__node), node_states[__state])
 
 #define first_online_node	first_node(node_states[N_ONLINE])
-#define next_online_node(nid)	next_node((nid), node_states[N_ONLINE])
+#define first_memory_node	first_node(node_states[N_MEMORY])
+static inline int next_online_node(int nid)
+{
+	return next_node(nid, node_states[N_ONLINE]);
+}
+static inline int next_memory_node(int nid)
+{
+	return next_node(nid, node_states[N_MEMORY]);
+}
 
 extern int nr_node_ids;
 extern int nr_online_nodes;
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -694,7 +694,7 @@ void pagefault_out_of_memory(void)
 	if (mem_cgroup_oom_synchronize(true))
 		return;
 
-	zonelist = node_zonelist(first_online_node, GFP_KERNEL);
+	zonelist = node_zonelist(first_memory_node, GFP_KERNEL);
 	if (try_set_zonelist_oom(zonelist, GFP_KERNEL)) {
 		out_of_memory(NULL, 0, 0, NULL, false);
 		clear_zonelist_oom(zonelist, GFP_KERNEL);

--
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>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-08-05  0:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-24  1:16 [patch 1/3] mm, oom: ensure memoryless node zonelist always includes zones David Rientjes
2014-07-24  1:16 ` [patch 2/3] mm, oom: remove unnecessary check for NULL zonelist David Rientjes
2014-07-31 15:26   ` Johannes Weiner
2014-08-01  9:10     ` David Rientjes
2014-08-01 13:34       ` Johannes Weiner
2014-08-01 21:42         ` David Rientjes
2014-08-02 18:13           ` Johannes Weiner
2014-08-05  0:18             ` David Rientjes
2014-07-24  1:16 ` [patch 3/3] mm, oom: rename zonelist locking functions David Rientjes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).