mm, oom: ensure sysrq+f always passes valid zonelist
authorDavid Rientjes <rientjes@google.com>
Wed, 14 Nov 2012 09:15:19 +0000 (01:15 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Nov 2012 01:13:48 +0000 (17:13 -0800)
With hotpluggable and memoryless nodes, it's possible that node 0 will
not be online, so use the first online node's zonelist rather than
hardcoding node 0 to pass a zonelist with all zones to the oom killer.

Signed-off-by: David Rientjes <rientjes@google.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/sysrq.c

index 16ee6cee07da6b3ba904dea07127f41d98c65133..b3c4a250ff86c6ad71b0e91de5cf02892a9d62a2 100644 (file)
@@ -346,7 +346,8 @@ static struct sysrq_key_op sysrq_term_op = {
 
 static void moom_callback(struct work_struct *ignored)
 {
-       out_of_memory(node_zonelist(0, GFP_KERNEL), GFP_KERNEL, 0, NULL, true);
+       out_of_memory(node_zonelist(first_online_node, GFP_KERNEL), GFP_KERNEL,
+                     0, NULL, true);
 }
 
 static DECLARE_WORK(moom_work, moom_callback);