lkml.org 
[lkml]   [2011]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 09/32] nohz: Move ts->idle_calls into strict idle logic
On Mon, Aug 29, 2011 at 07:59:49PM +0200, Peter Zijlstra wrote:
> On Mon, 2011-08-29 at 19:34 +0200, Frederic Weisbecker wrote:
> > On Mon, Aug 29, 2011 at 04:47:47PM +0200, Peter Zijlstra wrote:
> > > On Mon, 2011-08-15 at 17:52 +0200, Frederic Weisbecker wrote:
> > > > +static bool tick_nohz_can_stop_tick(int cpu, struct tick_sched *ts)
> > > > +{
> > > > + /*
> > > > + * If this cpu is offline and it is the one which updates
> > > > + * jiffies, then give up the assignment and let it be taken by
> > > > + * the cpu which runs the tick timer next. If we don't drop
> > > > + * this here the jiffies might be stale and do_timer() never
> > > > + * invoked.
> > > > + */
> > > > + if (unlikely(!cpu_online(cpu))) {
> > > > + if (cpu == tick_do_timer_cpu)
> > > > + tick_do_timer_cpu = TICK_DO_TIMER_NONE;
> > > > + }
> > > > +
> > > > + if (unlikely(ts->nohz_mode == NOHZ_MODE_INACTIVE))
> > > > + return false;
> > > > +
> > > > + if (need_resched())
> > > > + return false;
> > > > +
> > > > + if (unlikely(local_softirq_pending() && cpu_online(cpu))) {
> > > > + static int ratelimit;
> > > > +
> > > > + if (ratelimit < 10) {
> > > > + printk(KERN_ERR "NOHZ: local_softirq_pending %02x\n",
> > > > + (unsigned int) local_softirq_pending());
> > > > + ratelimit++;
> > > > + }
> > > > + return false;
> > > > + }
> > > > +
> > > > + return true;
> > > > +}
> > >
> > > Why aren't rcu_needs_cpu(), printk_needs_cpu() and arch_needs_cpu() not
> > > in there?
> > >
> > > That are typical 'can we go sleep now?' functions.
> >
> > Because when one of these functions are positive, the ts->next_jiffies and
> > ts->last_jiffies stats are updated. Not with the above.
> > Also I start to think the above checks are only useful in the idle case.
>
> Then call it tick_nohz_can_stop_tick_idle() or so, and create
> tick_nohz_can_stop_tick() to deal with all stuff.

Yeah I need to have a deeper look into these checks.

>
> > We still want tick_nohz_stop_sched_tick() to have the *needs_cpu() checks
> > so that they can restore a HZ periodic behaviour on interrupt return if
> > needed.
>
> Well, no, on interrupt return you shouldn't do anything. If you've
> stopped the tick it stays stopped until you do something that needs it,
> then that action will re-enable it.

Sure, when something needs the tick in this mode, we usually
receive an IPI and restart the tick from there but then
tick_nohz_stop_sched_tick() handles the cases with *needs_cpu()
very well on interrupt return (our IPI return) by doing a kind
of "light" HZ mode by logically switching to nohz mode but
with the next timer happening in HZ, assuming it's a matter
of one tick and we will switch to a real nohz behaviour soon.

I don't see a good reason to duplicate that logic with a pure
restart from the IPI.

> > That said I wonder if some of the above conditions should restore a periodic
> > behaviour on interrupt return...
>
> I would expect the tick not to be stopped when tick_nohz_can_stop_tick()
> returns false. If it returns true, then I expect anything that needs it
> to re-enable it.
>

Yeah. In the case of need_resched() in idle I believe the CPU doesn't
really go to sleep later so it should be fine. But for the case of
softirq pending or nohz_mode, I'm not sure...


\
 
 \ /
  Last update: 2011-08-29 20:27    [W:0.908 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site