[RFC:Patch: 006/008](memory hotplug) kswapd_stop() definition

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Badari Pulavarty <pbadari@...>
Cc: Andrew Morton <akpm@...>, Mel Gorman <mel@...>, Christoph Lameter <cl@...>, linux-mm <linux-mm@...>, Linux Kernel ML <linux-kernel@...>
Date: Thursday, July 31, 2008 - 8:02 am

This patch is to make kswapd_stop().
It must be stopped before node removing.


Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>

---
 include/linux/swap.h |    3 +++
 mm/vmscan.c          |   13 +++++++++++++
 2 files changed, 16 insertions(+)

Index: current/mm/vmscan.c
===================================================================
--- current.orig/mm/vmscan.c	2008-07-29 22:17:16.000000000 +0900
+++ current/mm/vmscan.c	2008-07-29 22:17:16.000000000 +0900
@@ -1985,6 +1985,9 @@ static int kswapd(void *p)
 		}
 		finish_wait(&pgdat->kswapd_wait, &wait);
 
+		if (kthread_should_stop())
+			break;
+
 		if (!try_to_freeze()) {
 			/* We can speed up thawing tasks if we don't call
 			 * balance_pgdat after returning from the refrigerator
@@ -2216,6 +2219,16 @@ int kswapd_run(int nid)
 	return ret;
 }
 
+#ifdef CONFIG_MEMORY_HOTREMOVE
+void kswapd_stop(int nid)
+{
+	pg_data_t *pgdat = NODE_DATA(nid);
+
+	if (pgdat->kswapd)
+		kthread_stop(pgdat->kswapd);
+}
+#endif
+
 static int __init kswapd_init(void)
 {
 	int nid;
Index: current/include/linux/swap.h
===================================================================
--- current.orig/include/linux/swap.h	2008-07-29 21:20:02.000000000 +0900
+++ current/include/linux/swap.h	2008-07-29 22:17:16.000000000 +0900
@@ -262,6 +262,9 @@ static inline void scan_unevictable_unre
 #endif
 
 extern int kswapd_run(int nid);
+#ifdef CONFIG_MEMORY_HOTREMOVE
+extern void kswapd_stop(int nid);
+#endif
 
 #ifdef CONFIG_MMU
 /* linux/mm/shmem.c */

-- 
Yasunori Goto 


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [RFC:Patch: 000/008](memory hotplug) rough idea of pgdat..., Christoph Lameter, (Thu Jul 31, 10:04 am)
[RFC:Patch: 006/008](memory hotplug) kswapd_stop() definition, Yasunori Goto, (Thu Jul 31, 8:02 am)