]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
memory hotplug: reset pgdat->kswapd to NULL if creating kernel thread fails
authorWen Congyang <wency@cn.fujitsu.com>
Fri, 7 Sep 2012 00:17:42 +0000 (10:17 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 7 Sep 2012 05:36:00 +0000 (15:36 +1000)
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>
mm/vmscan.c

index 8d01243d9560e0ea8d8a04cf51cd4087ed8b280d..99b434b674c02b4099bcfe58632ad56e183801fd 100644 (file)
@@ -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;