On Wed, 2007-08-22 at 12:43 -0700, Andrew Morton wrote:
> On Wed, 22 Aug 2007 12:02:54 -0700
> "Paul E. McKenney" <[email protected]> wrote:
> > This patch is a forward-port of RCU priority boosting (described in
> > http://lwn.net/Articles/220677/). It applies to 2.6.22 on top of
> > the patches sent in the http://lkml.org/lkml/2007/8/7/276 series and
> > the hotplug patch (http://lkml.org/lkml/2007/8/17/262). Passes several
> > hours of rcutorture on x86_64 and POWER, so OK for experimentation but
> > not ready for inclusion.
>
> It'd be nice to have a brief summary of why we might want this code in Linux.
RCU reclamation callbacks have to wait for all current RCU readers to
finish. With preemptible RCU read-side critical sections, other tasks
may block an RCU reader for an arbitrarily long time, and thus
indirectly block the execution of memory reclamation callbacks
(including anything using synchronize_rcu), leading to an OOM situation.
This patch adds priority boosting of RCU readers to avoid this scenario.
> > +#ifdef CONFIG_PREEMPT_RCU_BOOST
>
> Do we really need this? Why not just enable the feature all the time?
It involves both space and computation overhead, which you might want to
avoid if you don't need it. That said, it might make sense to turn it
on by default.
> > +config PREEMPT_RCU_BOOST_STATS_INTERVAL
>
> Four new config options? Sob. Zero would be preferable.
I only saw three new options.
At a minimum, having the debug toggle as a config option would make
debugging this significantly simpler.
> > + struct list_head rbs_toboost;
> > + struct list_head rbs_boosted;
> > + unsigned long rbs_blocked;
> > + unsigned long rbs_boost_attempt;
> > + unsigned long rbs_boost;
> > + unsigned long rbs_unlock;
> > + unsigned long rbs_unboosted;
> > +#ifdef CONFIG_PREEMPT_RCU_BOOST_STATS
> > + unsigned long rbs_stats[N_RCU_BOOST_DAT_EVENTS][N_RCU_BOOST_STATE];
> > +#endif /* #ifdef CONFIG_PREEMPT_RCU_BOOST_STATS */
> > +};
> > +#define RCU_BOOST_ELEMENTS 4
> > +
> > +int rcu_boost_idx = -1; /* invalid value in case someone uses RCU early. */
> > +DEFINE_PER_CPU(struct rcu_boost_dat, rcu_boost_dat[RCU_BOOST_ELEMENTS]);
>
> Do these need global scope?
No, neither one does. They should both become static.
> > +void init_rcu_boost_late(void)
> > +{
> > +
> > + /* Spawn RCU-boost task. */
> > +
> > + printk(KERN_INFO "Starting RCU priority booster\n");
> > + rcu_boost_task = kthread_run(rcu_booster, NULL, "RCU Prio Booster");
> > + if (IS_ERR(rcu_boost_task)) {
> > + printk(KERN_ALERT
> > + "Unable to create RCU Priority Booster, errno %ld\n",
> > + -PTR_ERR(rcu_boost_task));
> > +
> > + /*
> > + * Continue running, but tasks permanently blocked
> > + * in RCU read-side critical sections will be able
> > + * to stall grace-period processing, potentially
> > + * OOMing the machine.
> > + */
>
> I don't think we want to try to struggle along like that. This thread is a
> piece of core infrastructure: if we couldn't start it then just panic
> rather than trying to run the kernel in unknown and untested regions of
> operation.
In this situation, the kernel would behave precisely as it would with
CONFIG_RCU_BOOST=n. However, I agree that with CONFIG_RCU_BOOST=y you
would expect to always have priority boosting available, so I think
panic() makes sense here.
- Josh Triplett
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]