[PATCH 1/2] kthread: convert kswapd from kernel_thread

From: Serge E. Hallyn
Date: Thu Jun 15 2006 - 10:41:24 EST


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

Signed-off-by: Serge E. Hallyn <serue@xxxxxxxxxx>

---

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

fa35014607fbf5c98cd291abfc0e80ff149440f9
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 440a733..cc66dfe 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -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);
--
1.3.3

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/