aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/kthread.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/kernel/kthread.c b/kernel/kthread.c
index c013bf000ce6..4ebaf8519abf 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -97,19 +97,10 @@ static void create_kthread(struct kthread_create_info *create)
97 97
98 /* 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). */
99 pid = kernel_thread(kthread, create, CLONE_FS | CLONE_FILES | SIGCHLD); 99 pid = kernel_thread(kthread, create, CLONE_FS | CLONE_FILES | SIGCHLD);
100 if (pid < 0) { 100 if (pid < 0)
101 create->result = ERR_PTR(pid); 101 create->result = ERR_PTR(pid);
102 } else { 102 else
103 struct sched_param param = { .sched_priority = 0 };
104 wait_for_completion(&create->started); 103 wait_for_completion(&create->started);
105 /*
106 * root may have changed our (kthreadd's) priority or CPU mask.
107 * The kernel thread should not inherit these properties.
108 */
109 sched_setscheduler(create->result, SCHED_NORMAL, &param);
110 set_user_nice(create->result, KTHREAD_NICE_LEVEL);
111 set_cpus_allowed_ptr(create->result, cpu_all_mask);
112 }
113 complete(&create->done); 104 complete(&create->done);
114} 105}
115 106
@@ -152,11 +143,20 @@ struct task_struct *kthread_create(int (*threadfn)(void *data),
152 wait_for_completion(&create.done); 143 wait_for_completion(&create.done);
153 144
154 if (!IS_ERR(create.result)) { 145 if (!IS_ERR(create.result)) {
146 struct sched_param param = { .sched_priority = 0 };
155 va_list args; 147 va_list args;
148
156 va_start(args, namefmt); 149 va_start(args, namefmt);
157 vsnprintf(create.result->comm, sizeof(create.result->comm), 150 vsnprintf(create.result->comm, sizeof(create.result->comm),
158 namefmt, args); 151 namefmt, args);
159 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, &param);
158 set_user_nice(create.result, KTHREAD_NICE_LEVEL);
159 set_cpus_allowed_ptr(create.result, cpu_all_mask);
160 } 160 }
161 return create.result; 161 return create.result;
162} 162}