Skip to content

Commit

Permalink
memory hotplug: reset pgdat->kswapd to NULL if creating kernel thread…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
wencongyang authored and torvalds committed Sep 17, 2012
1 parent 6bf6104 commit 18b48d5
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 18b48d5

Please sign in to comment.