From: "Paul E. McKenney" <paulmck@us.ibm.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: dipankar@in.ibm.com, Ingo Molnar <mingo@elte.hu>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] RCU and CONFIG_PREEMPT_RT progress
Date: Tue, 10 May 2005 13:29:15 -0700 [thread overview]
Message-ID: <20050510202915.GH1566@us.ibm.com> (raw)
In-Reply-To: <1115755692.26548.15.camel@twins>
On Tue, May 10, 2005 at 10:08:11PM +0200, Peter Zijlstra wrote:
> On Mon, 2005-05-09 at 18:24 -0700, Paul E. McKenney wrote:
>
> >
> > Counter-Based Approach
> >
> > The current implementation in Ingo's CONFIG_PREEMPT_RT patch uses a
> > counter-based approach, which seems to work, but which can result in
> > indefinite-duration grace periods. The following are very hazy thoughts
> > on how to get the benefits of this approach, but with short grace periods.
> >
> > 1. The basic trick is to maintain a pair of counters per CPU.
> > There would also be a global boolean variable that would select
> > one or the other of each pair. The rcu_read_lock() primitive
> > would then increment the counter indicated by the boolean
> > corresponding to the CPU that it is currently running on.
> > It would also keep a pointer to that particular counter in
> > the task structure. The rcu_read_unlock() primitive would
> > decrement this counter. (And, yes, you would also have a
> > counter in the task structure so that only the outermost of
> > a set of nested rcu_read_lock()/rcu_read_unlock() pairs would
> > actually increment/decrement the per-CPU counter pairs.)
> >
> > To force a grace period, one would invert the value of the
> > global boolean variable. Once all the counters indicated
> > by the old value of the global boolean variable hit zero,
> > the corresponding set of RCU callbacks can be safely invoked.
> >
> > The big problem with this approach is that a pair of inversions
> > of the global boolean variable could be spaced arbitrarily
> > closely, especially when you consider that the read side code
> > can be preempted. This could cause RCU callbacks to be invoked
> > prematurely, which could greatly reduce the life expectancy
> > of your kernel.
>
> > Thoughts?
>
> How about having another boolean indicating the ability to flip the
> selector boolean. This boolean would be set false on an actual flip and
> cleared during a grace period. That way the flips cannot ever interfere
> with one another such that the callbacks would be cleared prematurely.
But the flip is an integral part of detecting a grace period. So, if I
understand your proposal correctly, I would have to flip to figure out
when it was safe to flip.
What am I missing here?
Thanx, Paul
next prev parent reply other threads:[~2005-05-10 20:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-10 1:24 [RFC] RCU and CONFIG_PREEMPT_RT progress Paul E. McKenney
2005-05-10 10:55 ` Esben Nielsen
2005-05-10 14:45 ` Paul E. McKenney
2005-05-11 18:14 ` Esben Nielsen
2005-05-12 1:43 ` Paul E. McKenney
2005-05-10 20:08 ` Peter Zijlstra
2005-05-10 20:18 ` Valdis.Kletnieks
2005-05-10 20:29 ` Paul E. McKenney [this message]
2005-05-10 20:56 ` Peter Zijlstra
2005-05-10 22:36 ` Paul E. McKenney
2005-05-12 8:24 ` Peter Zijlstra
2005-05-12 14:30 ` Paul E. McKenney
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=20050510202915.GH1566@us.ibm.com \
--to=paulmck@us.ibm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=dipankar@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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