From: Rusty Russell <rusty@rustcorp.com.au>
To: Srivatsa Vaddagiri <vatsa@in.ibm.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>,
Ingo Molnar <mingo@elte.hu>, Andrew Morton <akpm@osdl.org>,
lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>,
LHCS list <lhcs-devel@lists.sourceforge.net>
Subject: Re: [Experimental CPU Hotplug PATCH] - Move migrate_all_tasks to CPU_DEAD handling
Date: Wed, 07 Apr 2004 15:32:12 +1000 [thread overview]
Message-ID: <1081315931.5922.151.camel@bach> (raw)
In-Reply-To: <20040407050111.GA10256@in.ibm.com>
On Wed, 2004-04-07 at 15:01, Srivatsa Vaddagiri wrote:
> I restore the mask though (under covers of lock_cpu_hotplug) before
> returning from cpu_down. Task should never see this violated affinity.
But other tasks can do a getaffinity() on it and see the wrong affinity.
Probably not a big issue.
> Rusty,
> What do you think abt the whole patch? It has withstood
> my stress-test harness :-)
I agree with Ingo: it's clever, well done. Minor nitpicks:
+void migrate_all_tasks(int cpu)
{
struct task_struct *tsk, *t;
int dest_cpu, src_cpu;
unsigned int node;
- /* We're nailed to this CPU. */
- src_cpu = smp_processor_id();
+ src_cpu = cpu;
Just make the parameter name "src_cpu"?
+ /* Take idle task off runqueue and restore it's
+ * policy/priority
+ */
+ rq = task_rq_lock(rq->idle, &flags);
+
+ /* Call init_idle instead ?? init_idle doesn't restore
the
+ * policy though for us ..
+ */
+ deactivate_task(rq->idle, rq);
+ __setscheduler(rq->idle, SCHED_NORMAL, MAX_PRIO);
+
+ task_rq_unlock(rq, &flags);
One-line comments and compact code good:
/* Idle task back to normal (off runqueue, low prio) */
rq = task_rq_lock(rq->idle, &flags);
deactivate_task(rq->idle, rq);
__setscheduler(rq->idle, SCHED_NORMAL, MAX_PRIO);
task_rq_unlock(rq, &flags);
+ /* Force scheduler to switch to idle task when we yield.
+ * We expect idle task to _immediately_ notice that it's
cpu
+ * is offline and die quickly.
+ *
+ * This allows us to defer calling mirate_all_tasks
until
+ * CPU_DEAD notification time.
+ */
+ sched_idle_next();
This comment's very big. They don't need to know all the things we
don't do. I'd prefer:
/* Force idle task to run as soon as we yield: it should
immediately notice cpu is offline and die quickly. */
I'm happy for this to go in..
Rusty
--
Anyone who quotes me in their signature is an idiot -- Rusty Russell
next prev parent reply other threads:[~2004-04-07 5:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-05 12:18 [Experimental CPU Hotplug PATCH] - Move migrate_all_tasks to CPU_DEAD handling Srivatsa Vaddagiri
2004-04-06 0:28 ` Nick Piggin
2004-04-06 1:15 ` Srivatsa Vaddagiri
2004-04-06 1:27 ` Nick Piggin
2004-04-06 1:30 ` Nick Piggin
2004-04-06 16:43 ` [lhcs-devel] " Srivatsa Vaddagiri
2004-04-06 8:37 ` Srivatsa Vaddagiri
2004-04-06 9:26 ` Nick Piggin
2004-04-06 14:56 ` Srivatsa Vaddagiri
2004-04-06 15:04 ` Nick Piggin
2004-04-06 15:20 ` Srivatsa Vaddagiri
2004-04-07 3:54 ` Rusty Russell
2004-04-07 4:11 ` Nick Piggin
2004-04-07 5:01 ` Srivatsa Vaddagiri
2004-04-07 5:32 ` Rusty Russell [this message]
2004-04-07 14:17 ` Srivatsa Vaddagiri
2004-04-07 22:55 ` Rusty Russell
2004-04-12 16:08 ` [lhcs-devel] " Srivatsa Vaddagiri
2004-04-06 7:25 ` Ingo Molnar
2004-04-06 14:53 ` Srivatsa Vaddagiri
2004-04-06 15:03 ` Srivatsa Vaddagiri
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=1081315931.5922.151.camel@bach \
--to=rusty@rustcorp.com.au \
--cc=akpm@osdl.org \
--cc=lhcs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=nickpiggin@yahoo.com.au \
--cc=vatsa@in.ibm.com \
/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;
as well as URLs for NNTP newsgroup(s).