From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>,
Clark Williams <williams@redhat.com>,
Gregory Haskins <ghaskins@novell.com>,
Gautham R Shenoy <ego@in.ibm.com>,
Pekka Enberg <penberg@cs.helsinki.fi>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [PATCH -rt 5/5] cpu-hotplug: cpu_down vs preempt-rt
Date: Tue, 10 Jun 2008 09:17:41 -0700 [thread overview]
Message-ID: <20080610161741.GG15481@linux.vnet.ibm.com> (raw)
In-Reply-To: <1213113078.31518.16.camel@twins>
On Tue, Jun 10, 2008 at 05:51:18PM +0200, Peter Zijlstra wrote:
> On Tue, 2008-06-10 at 08:33 -0700, Paul E. McKenney wrote:
> > On Tue, Jun 10, 2008 at 01:13:04PM +0200, Peter Zijlstra wrote:
> > > idle_task_exit() calls mmdrop() from the idle thread, but in PREEMPT_RT all the
> > > allocator locks are sleeping locks - for obvious reasons scheduling away the
> > > idle thread gives some curious problems.
> > >
> > > Solve this by pushing the mmdrop() into an RCU callback, however we can't use
> > > RCU because the CPU is already down and all the local RCU state has been
> > > destroyed.
> > >
> > > Therefore create a new call_rcu() variant that enqueues the callback on an
> > > online cpu.
> >
> > I am a bit nervous about the non-determinism, but on the other hand
> > CPU online/offline events can only happen so often due to the locking.
> >
> > So...
> >
> > Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
>
> Thanks!
>
> Yesterday you suggested using rcu_cpu_online_map and fliplock to avoid
> the loop here:
>
> > > +void fastcall call_rcu_preempt_online(struct rcu_head *head,
> > > + void (*func)(struct rcu_head *rcu))
> > > +{
> > > + struct rcu_data *rdp;
> > > + unsigned long flags;
> > > + int cpu;
> > > +
> > > + head->func = func;
> > > + head->next = NULL;
> > > +again:
> > > + cpu = first_cpu(cpu_online_map);
> > > + rdp = RCU_DATA_CPU(cpu);
> > > +
> > > + spin_lock_irqsave(&rdp->lock, flags);
> > > + if (unlikely(!cpu_online(cpu))) {
> > > + /*
> > > + * cpu is removed from the online map before rcu_offline_cpu
> > > + * is called.
> > > + */
> > > + spin_unlock_irqrestore(&rdp->lock, flags);
> > > + goto again;
> > > + }
> > > +
> > > + *rdp->nexttail = head;
> > > + rdp->nexttail = &head->next;
> > > + spin_unlock_irqrestore(&rdp->lock, flags);
> > > +
> > > +}
>
> But then the code would look like:
>
> spin_lock_irqsave(&rcu_ctrlblk.fliplock, flags);
> cpu = first_cpu(rcu_cpu_online_map);
> rdp = RCU_DATA_CPU(cpu);
> spin_lock(&rdp->lock);
>
> creating a nesting between these two locks, where I could not find one.
>
> Do you still prefer I look into changing it into such a form, or are you
> sufficiently non-caring that the current code can stand? :-)
I am equally bothered by the non-determinism and by the nesting, hence
the current code can stand, at least until it causes a real problem.
Thanx, Paul
next prev parent reply other threads:[~2008-06-10 16:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-10 11:12 [PATCH -rt 0/5] hotplug fixes Peter Zijlstra
2008-06-10 11:13 ` [PATCH -rt 1/5] cpu-hotplug: vs slab Peter Zijlstra
2008-06-10 11:13 ` [PATCH -rt 2/5] cpu-hotplug: vs page_alloc Peter Zijlstra
2008-06-10 11:13 ` [PATCH -rt 3/5] cpu-hotplug: cpu_up vs preempt-rt Peter Zijlstra
2008-06-10 11:13 ` [PATCH -rt 4/5] rcu: backport RCU cpu hotplug support Peter Zijlstra
2008-06-10 15:15 ` Paul E. McKenney
2008-06-10 11:13 ` [PATCH -rt 5/5] cpu-hotplug: cpu_down vs preempt-rt Peter Zijlstra
2008-06-10 15:33 ` Paul E. McKenney
2008-06-10 15:51 ` Peter Zijlstra
2008-06-10 16:17 ` Paul E. McKenney [this message]
2008-06-11 6:53 ` [PATCH -rt 6/5] " Peter Zijlstra
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=20080610161741.GG15481@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=ego@in.ibm.com \
--cc=ghaskins@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=penberg@cs.helsinki.fi \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=williams@redhat.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
all inboxes | Powered by JetHome®