summaryrefslogtreecommitdiff
path: root/mm/vmscan.c
diff options
context:
space:
mode:
authorWen Congyang <wency@cn.fujitsu.com>2012-09-18 01:08:55 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-09-18 02:00:37 +0400
commit18b48d5873a6fc8e0e6044ddb572fcda26988f19 (patch)
tree0f26f8c1e70b8d07b1e45b36f0dfc1b1c7a60131 /mm/vmscan.c
parent6bf6104573482570f7103d3e5ddf9574db43a363 (diff)
downloadlinux-18b48d5873a6fc8e0e6044ddb572fcda26988f19.tar.xz
memory hotplug: reset pgdat->kswapd to NULL if creating kernel thread fails
If kthread_run() fails, pgdat->kswapd contains errno. When we stop this thread, we only check whether pgdat->kswapd is NULL and access it. If it contains errno, it will cause page fault. Reset pgdat->kswapd to NULL when creating kernel thread fails can avoid this problem. Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> Reviewed-by: Minchan Kim <minchan@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmscan.c')
-rw-r--r--mm/vmscan.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 8d01243d9560..99b434b674c0 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3102,6 +3102,7 @@ int kswapd_run(int nid)
/* failure at boot is fatal */
BUG_ON(system_state == SYSTEM_BOOTING);
printk("Failed to start kswapd on node %d\n",nid);
+ pgdat->kswapd = NULL;
ret = -1;
}
return ret;