From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, pjt@google.com,
tglx@linutronix.de, seto.hidetoshi@jp.fujitsu.com
Subject: Re: [PATCH RFC] sched: Make migration_call() safe for stop_machine()-free hotplug
Date: Fri, 17 Aug 2012 13:26:48 -0700 [thread overview]
Message-ID: <20120817202648.GA13304@linux.vnet.ibm.com> (raw)
In-Reply-To: <20120816215511.GA30518@linux.vnet.ibm.com>
On Thu, Aug 16, 2012 at 02:55:11PM -0700, Paul E. McKenney wrote:
> On Thu, Aug 16, 2012 at 12:17:10PM -0700, Paul E. McKenney wrote:
>
> [ . . . ]
>
> > Another attempted patch below.
>
> But this time without the brain-dead "using smp_processor_id() in
> preemptible" bug.
And the below version passes moderate rcutorture testing.
Thanx, Paul
> ------------------------------------------------------------------------
>
> sched: Make migration_call() safe for stop_machine()-free hotplug
>
> The CPU_DYING branch of migration_call() relies on the fact that
> CPU-hotplug offline operations use stop_machine(). This commit therefore
> attempts to remedy this situation by moving work to the CPU_DEAD
> notifier when the outgoing CPU is quiescent. This requires a small
> change to migrate_nr_uninterruptible() to move counts to the current
> running CPU instead of a randomly selected CPU.
>
> Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index d325c4b..d09c4e0 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5303,12 +5303,12 @@ void idle_task_exit(void)
> * While a dead CPU has no uninterruptible tasks queued at this point,
> * it might still have a nonzero ->nr_uninterruptible counter, because
> * for performance reasons the counter is not stricly tracking tasks to
> - * their home CPUs. So we just add the counter to another CPU's counter,
> + * their home CPUs. So we just add the counter to the running CPU's counter,
> * to keep the global sum constant after CPU-down:
> */
> static void migrate_nr_uninterruptible(struct rq *rq_src)
> {
> - struct rq *rq_dest = cpu_rq(cpumask_any(cpu_active_mask));
> + struct rq *rq_dest = cpu_rq(smp_processor_id());
>
> rq_dest->nr_uninterruptible += rq_src->nr_uninterruptible;
> rq_src->nr_uninterruptible = 0;
> @@ -5613,9 +5613,19 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
> migrate_tasks(cpu);
> BUG_ON(rq->nr_running != 1); /* the migration thread */
> raw_spin_unlock_irqrestore(&rq->lock, flags);
> + break;
>
> - migrate_nr_uninterruptible(rq);
> - calc_global_load_remove(rq);
> + case CPU_DEAD:
> + {
> + struct rq *dest_rq = cpu_rq(smp_processor_id());
> +
> + local_irq_save(flags);
> + raw_spin_lock(&dest_rq->lock);
> + migrate_nr_uninterruptible(rq);
> + calc_global_load_remove(rq);
> + raw_spin_unlock(&dest_rq->lock);
> + local_irq_restore(flags);
> + }
> break;
> #endif
> }
prev parent reply other threads:[~2012-08-17 20:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-25 21:51 [PATCH RFC] sched: Make migration_call() safe for stop_machine()-free hotplug Paul E. McKenney
2012-08-16 9:53 ` Peter Zijlstra
2012-08-16 19:17 ` Paul E. McKenney
2012-08-16 21:55 ` Paul E. McKenney
2012-08-17 20:26 ` Paul E. McKenney [this message]
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=20120817202648.GA13304@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=pjt@google.com \
--cc=seto.hidetoshi@jp.fujitsu.com \
--cc=tglx@linutronix.de \
/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).