From: Oleg Nesterov <oleg@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Christoph Hellwig <hch@lst.de>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Ingo Molnar <mingo@elte.hu>, Pavel Emelyanov <xemul@openvz.org>,
Rusty Russell <rusty@rustcorp.com.au>,
Vitaliy Gusev <vgusev@openvz.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/4] kthreads: move sched-realeted initialization from kthreadd context
Date: Fri, 30 Jan 2009 13:33:50 +0100 [thread overview]
Message-ID: <20090130123350.GA26206@redhat.com> (raw)
(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, ¶m);
- 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, ¶m);
+ set_user_nice(create.result, KTHREAD_NICE_LEVEL);
+ set_cpus_allowed_ptr(create.result, CPU_MASK_ALL_PTR);
}
return create.result;
}
next reply other threads:[~2009-01-30 12:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-30 12:33 Oleg Nesterov [this message]
2009-01-31 10:47 ` [PATCH 1/4] kthreads: move sched-realeted initialization from kthreadd context Rusty Russell
2009-02-01 10:38 ` Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090130123350.GA26206@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rusty@rustcorp.com.au \
--cc=vgusev@openvz.org \
--cc=xemul@openvz.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox