summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kernel/kthread.c2
-rw-r--r--mm/vmscan.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/kernel/kthread.c b/kernel/kthread.c
index 6a5373868a9..c5f3c6613b6 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -115,7 +115,9 @@ static void keventd_create_kthread(void *_create)
create->result = ERR_PTR(pid);
} else {
wait_for_completion(&create->started);
+ read_lock(&tasklist_lock);
create->result = find_task_by_pid(pid);
+ read_unlock(&tasklist_lock);
}
complete(&create->done);
}
diff --git a/mm/vmscan.c b/mm/vmscan.c
index fd572bbdc9f..78865c849f8 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1356,7 +1356,9 @@ static int __init kswapd_init(void)
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);
}
total_memory = nr_free_pagecache_pages();
hotcpu_notifier(cpu_callback, 0);