diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-04-20 12:08:07 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-20 12:08:12 -0400 |
commit | 62d170290979e0bb805d969cca4ea852bdd45260 (patch) | |
tree | 837372297501a2d144358b44e7db3f88c5612aa2 /kernel/kthread.c | |
parent | 8b5b94e4e9813cdd77103827f48d58c806ab45c6 (diff) | |
parent | d91dfbb41bb2e9bdbfbd2cc7078ed7436eab027a (diff) |
Merge branch 'linus' into x86/urgent
Merge reason: We need the x86/uv updates from upstream, to queue up
dependent fix.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/kthread.c')
-rw-r--r-- | kernel/kthread.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/kernel/kthread.c b/kernel/kthread.c index 84bbadd4d021..4ebaf8519abf 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c | |||
@@ -76,6 +76,7 @@ static int kthread(void *_create) | |||
76 | 76 | ||
77 | /* OK, tell user we're spawned, wait for stop or wakeup */ | 77 | /* OK, tell user we're spawned, wait for stop or wakeup */ |
78 | __set_current_state(TASK_UNINTERRUPTIBLE); | 78 | __set_current_state(TASK_UNINTERRUPTIBLE); |
79 | create->result = current; | ||
79 | complete(&create->started); | 80 | complete(&create->started); |
80 | schedule(); | 81 | schedule(); |
81 | 82 | ||
@@ -96,22 +97,10 @@ static void create_kthread(struct kthread_create_info *create) | |||
96 | 97 | ||
97 | /* We want our own signal handler (we take no signals by default). */ | 98 | /* We want our own signal handler (we take no signals by default). */ |
98 | pid = kernel_thread(kthread, create, CLONE_FS | CLONE_FILES | SIGCHLD); | 99 | pid = kernel_thread(kthread, create, CLONE_FS | CLONE_FILES | SIGCHLD); |
99 | if (pid < 0) { | 100 | if (pid < 0) |
100 | create->result = ERR_PTR(pid); | 101 | create->result = ERR_PTR(pid); |
101 | } else { | 102 | else |
102 | struct sched_param param = { .sched_priority = 0 }; | ||
103 | wait_for_completion(&create->started); | 103 | wait_for_completion(&create->started); |
104 | read_lock(&tasklist_lock); | ||
105 | create->result = find_task_by_pid_ns(pid, &init_pid_ns); | ||
106 | read_unlock(&tasklist_lock); | ||
107 | /* | ||
108 | * root may have changed our (kthreadd's) priority or CPU mask. | ||
109 | * The kernel thread should not inherit these properties. | ||
110 | */ | ||
111 | sched_setscheduler(create->result, SCHED_NORMAL, ¶m); | ||
112 | set_user_nice(create->result, KTHREAD_NICE_LEVEL); | ||
113 | set_cpus_allowed_ptr(create->result, cpu_all_mask); | ||
114 | } | ||
115 | complete(&create->done); | 104 | complete(&create->done); |
116 | } | 105 | } |
117 | 106 | ||
@@ -154,11 +143,20 @@ struct task_struct *kthread_create(int (*threadfn)(void *data), | |||
154 | wait_for_completion(&create.done); | 143 | wait_for_completion(&create.done); |
155 | 144 | ||
156 | if (!IS_ERR(create.result)) { | 145 | if (!IS_ERR(create.result)) { |
146 | struct sched_param param = { .sched_priority = 0 }; | ||
157 | va_list args; | 147 | va_list args; |
148 | |||
158 | va_start(args, namefmt); | 149 | va_start(args, namefmt); |
159 | vsnprintf(create.result->comm, sizeof(create.result->comm), | 150 | vsnprintf(create.result->comm, sizeof(create.result->comm), |
160 | namefmt, args); | 151 | namefmt, args); |
161 | va_end(args); | 152 | va_end(args); |
153 | /* | ||
154 | * root may have changed our (kthreadd's) priority or CPU mask. | ||
155 | * The kernel thread should not inherit these properties. | ||
156 | */ | ||
157 | sched_setscheduler_nocheck(create.result, SCHED_NORMAL, ¶m); | ||
158 | set_user_nice(create.result, KTHREAD_NICE_LEVEL); | ||
159 | set_cpus_allowed_ptr(create.result, cpu_all_mask); | ||
162 | } | 160 | } |
163 | return create.result; | 161 | return create.result; |
164 | } | 162 | } |