lkml.org 
[lkml]   [2009]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 1/4] kthreads: move sched-realeted initialization from kthreadd context
(on top of kthread-dont-looking-for-a-task-in-create_kthread-2.patch)

kthreadd is the single thread which implements ths "create" request,
move sched_setscheduler/etc from create_kthread() to kthread_create()
to improve the scalability.

We should be careful with sched_setscheduler(), use _nochek helper.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>

--- 6.29-rc3/kernel/kthread.c~1_SCHED 2009-01-30 09:40:12.000000000 +0100
+++ 6.29-rc3/kernel/kthread.c 2009-01-30 09:46:29.000000000 +0100
@@ -100,15 +100,7 @@ static void create_kthread(struct kthrea
if (pid < 0) {
create->result = ERR_PTR(pid);
} else {
- struct sched_param param = { .sched_priority = 0 };
wait_for_completion(&create->started);
- /*
- * root may have changed our (kthreadd's) priority or CPU mask.
- * The kernel thread should not inherit these properties.
- */
- sched_setscheduler(create->result, SCHED_NORMAL, &param);
- set_user_nice(create->result, KTHREAD_NICE_LEVEL);
- set_cpus_allowed_ptr(create->result, CPU_MASK_ALL_PTR);
}
complete(&create->done);
}
@@ -152,11 +144,20 @@ struct task_struct *kthread_create(int (
wait_for_completion(&create.done);

if (!IS_ERR(create.result)) {
+ struct sched_param param = { .sched_priority = 0 };
va_list args;
+
va_start(args, namefmt);
vsnprintf(create.result->comm, sizeof(create.result->comm),
namefmt, args);
va_end(args);
+ /*
+ * root may have changed our (kthreadd's) priority or CPU mask.
+ * The kernel thread should not inherit these properties.
+ */
+ sched_setscheduler_nocheck(create.result, SCHED_NORMAL, &param);
+ set_user_nice(create.result, KTHREAD_NICE_LEVEL);
+ set_cpus_allowed_ptr(create.result, CPU_MASK_ALL_PTR);
}
return create.result;
}


\
 
 \ /
  Last update: 2009-01-30 13:41    [W:0.039 / U:0.700 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site