From: Ingo Molnar <mingo@elte.hu>
To: Andrew Morton <akpm@osdl.org>
Cc: Nick Piggin <piggin@cyberone.com.au>,
Andrew Morton <akpm@osdl.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [patch] improve SMP reschedule and idle routines
Date: Fri, 27 May 2005 11:20:24 +0200 [thread overview]
Message-ID: <20050527092024.GA27567@elte.hu> (raw)
In-Reply-To: <4296E45B.1080509@yahoo.com.au>
* Nick Piggin <nickpiggin@yahoo.com.au> wrote:
> >the need_resched changes are not needed meanwhile - we can do the first
> >schedule() in rest_init() just fine. (See my earlier patch below.) So
> >please keep the need_resched thing out of your patch.
> >
>
> OK that's better. Sorry I didn't see your patch earlier.
>
> I'll redo this patch. Coming up...
Andrew: please drop the following two patches:
sched-remove-set_tsk_need_resched-from-init_idle-v2.patch
sched-remove-set_tsk_need_resched-from-init_idle-v2-ia64-fix.patch
and add the one below. The only followup patch
(sched-voluntary-kernel-preemption.patch) should still apply cleanly.
Nick's upcoming patch can then come afterwards.
----
This patch tweaks idle thread setup semantics a bit: instead of setting
NEED_RESCHED in init_idle(), we do an explicit schedule() before
calling into cpu_idle().
This patch, while having no negative side-effects, enables wider use of
cond_resched()s. (which might happen in the stock kernel too, but it's
particulary important for voluntary-preempt)
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
--- linux/kernel/sched.c.orig
+++ linux/kernel/sched.c
@@ -4163,6 +4163,14 @@ void show_state(void)
read_unlock(&tasklist_lock);
}
+/**
+ * init_idle - set up an idle thread for a given CPU
+ * @idle: task in question
+ * @cpu: cpu the idle task belongs to
+ *
+ * NOTE: this function does not set the idle thread's NEED_RESCHED
+ * flag, to make booting more robust.
+ */
void __devinit init_idle(task_t *idle, int cpu)
{
runqueue_t *rq = cpu_rq(cpu);
@@ -4180,7 +4188,6 @@ void __devinit init_idle(task_t *idle, i
#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW)
idle->oncpu = 1;
#endif
- set_tsk_need_resched(idle);
spin_unlock_irqrestore(&rq->lock, flags);
/* Set the preempt count _outside_ the spinlocks! */
--- linux/init/main.c.orig
+++ linux/init/main.c
@@ -383,6 +383,13 @@ static void noinline rest_init(void)
numa_default_policy();
unlock_kernel();
preempt_enable_no_resched();
+
+ /*
+ * The boot idle thread must execute schedule()
+ * at least once to get things moving:
+ */
+ schedule();
+
cpu_idle();
}
next prev parent reply other threads:[~2005-05-27 9:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-27 7:21 [patch] improve SMP reschedule and idle routines Nick Piggin
2005-05-27 8:57 ` Ingo Molnar
2005-05-27 9:11 ` Nick Piggin
2005-05-27 9:20 ` Ingo Molnar [this message]
2005-05-27 9:37 ` Nick Piggin
2005-05-27 10:12 ` Ingo Molnar
2005-06-01 6:15 ` Andrew Morton
2005-06-01 6:31 ` Nick Piggin
-- strict thread matches above, loose matches on Subject: below --
2005-05-16 13:51 Oleg Nesterov
2005-05-16 22:52 ` Nick Piggin
2005-05-16 4:21 Nick Piggin
[not found] ` <20050515.220455.59467677.davem@davemloft.net>
2005-05-16 5:19 ` Nick Piggin
[not found] ` <20050515.222722.63128129.davem@davemloft.net>
2005-05-16 5:34 ` Nick Piggin
2005-05-17 7:34 ` Nick Piggin
2005-05-17 7:40 ` Ingo Molnar
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=20050527092024.GA27567@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=piggin@cyberone.com.au \
/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