* [PATCH] memory hotplug: reset pgdat->kswapd to NULL if creating kernel thread fails
@ 2012-08-21 6:31 Wen Congyang
2012-08-21 7:37 ` Minchan Kim
0 siblings, 1 reply; 2+ messages in thread
From: Wen Congyang @ 2012-08-21 6:31 UTC (permalink / raw)
To: Andrew Morton, mgorman, KAMEZAWA Hiroyuki, hughd, minchan,
linux-mm, linux-kernel@vger.kernel.org
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>
---
mm/vmscan.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 347b3ff..1e8e2aa 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2953,6 +2953,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;
--
1.7.1
--
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 related [flat|nested] 2+ messages in thread
* Re: [PATCH] memory hotplug: reset pgdat->kswapd to NULL if creating kernel thread fails
2012-08-21 6:31 [PATCH] memory hotplug: reset pgdat->kswapd to NULL if creating kernel thread fails Wen Congyang
@ 2012-08-21 7:37 ` Minchan Kim
0 siblings, 0 replies; 2+ messages in thread
From: Minchan Kim @ 2012-08-21 7:37 UTC (permalink / raw)
To: Wen Congyang
Cc: Andrew Morton, mgorman, KAMEZAWA Hiroyuki, hughd, linux-mm,
linux-kernel@vger.kernel.org
On Tue, Aug 21, 2012 at 02:31:19PM +0800, Wen Congyang wrote:
> 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>
Nitpick: Why doesn't online_pages check kswapd_run's return value?
I hope memory-hotplug can handle this error rightly without
relying on this patch in the future.
--
Kind regards,
Minchan Kim
--
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] 2+ messages in thread
end of thread, other threads:[~2012-08-21 7:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-21 6:31 [PATCH] memory hotplug: reset pgdat->kswapd to NULL if creating kernel thread fails Wen Congyang
2012-08-21 7:37 ` Minchan Kim
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).