Skip to contentSkip to conversation

kthread: convert kswapd from kernel_thread

PATCH New Serge E. Hallyn 1 participant 1 message Jun 15, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 kthread: convert kswapd from kernel_thread

Convert kswapd from a (deprecated) kernel_thread to a kthread.

---

 mm/vmscan.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

fa35014607fbf5c98cd291abfc0e80ff149440f9

mm/vmscan.c +4 -8
index 440a733..cc66dfe 100644
@@ -34,6 +34,7 @@ #include <linux/cpuset.h>
 #include <linux/notifier.h>
 #include <linux/rwsem.h>
 #include <linux/delay.h>
+#include <linux/kthread.h>
 
 #include <asm/tlbflush.h>
 #include <asm/div64.h>
@@ -1220,7 +1221,6 @@ static int kswapd(void *p)
 	};
 	cpumask_t cpumask;
 
-	daemonize("kswapd%d", pgdat->node_id);
 	cpumask = node_to_cpumask(pgdat->node_id);
 	if (!cpus_empty(cpumask))
 		set_cpus_allowed(tsk, cpumask);
@@ -1352,13 +1352,9 @@ static int __init kswapd_init(void)
 
 	swap_setup();
 	for_each_online_pgdat(pgdat) {
-		pid_t pid;
-
-		pid = kernel_thread(kswapd, pgdat, CLONE_KERNEL);
-		BUG_ON(pid < 0);
-		read_lock(&tasklist_lock);
-		pgdat->kswapd = find_task_by_pid(pid);
-		read_unlock(&tasklist_lock);
+		pgdat->kswapd = kthread_run(kswapd, pgdat, "kswapd%d",
+						pgdat->node_id);
+		BUG_ON(IS_ERR(pgdat->kswapd));
 	}
 	total_memory = nr_free_pagecache_pages();
 	hotcpu_notifier(cpu_callback, 0);
Signature · 1 line
1.3.3