From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Josh Triplett <josh@joshtriplett.org>
Cc: Jacob Pan <jacob.jun.pan@linux.intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
John Stultz <john.stultz@linaro.org>,
LKML <linux-kernel@vger.kernel.org>,
Arjan van de Ven <arjan@linux.intel.com>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Len Brown <len.brown@intel.com>,
Rafael Wysocki <rafael.j.wysocki@intel.com>,
Eduardo Valentin <edubezval@gmail.com>,
Paul Turner <pjt@google.com>
Subject: Re: [PATCH 2/4] timer: relax tick stop in idle entry
Date: Mon, 16 Nov 2015 18:53:42 -0800 [thread overview]
Message-ID: <20151117025342.GP5184@linux.vnet.ibm.com> (raw)
In-Reply-To: <20151117014103.GA6629@x>
On Mon, Nov 16, 2015 at 05:41:03PM -0800, Josh Triplett wrote:
> On Mon, Nov 16, 2015 at 03:26:40PM -0800, Paul E. McKenney wrote:
> > On Mon, Nov 16, 2015 at 02:32:11PM -0800, Josh Triplett wrote:
> > > On Mon, Nov 16, 2015 at 01:51:26PM -0800, Jacob Pan wrote:
> > > > On Mon, 16 Nov 2015 16:06:57 +0100 (CET)
> > > > Thomas Gleixner <tglx@linutronix.de> wrote:
> > > >
> > > > > > <idle>-0 [000] 30.093474: bprint:
> > > > > > __tick_nohz_idle_enter: JPAN: tick_nohz_stop_sched_tick 609 delta
> > > > > > 1000000 [JP] but sees delta is exactly 1 tick away. didn't stop
> > > > > > tick.
> > > > >
> > > > > If the delta is 1 tick then it is not supposed to stop it. Did you
> > > > > ever try to figure out WHY it is 1 tick?
> > > > >
> > > > > There are two code pathes which can set it to basemono + TICK_NSEC:
> > > > >
> > > > > if (rcu_needs_cpu(basemono, &next_rcu) ||
> > > > > arch_needs_cpu() || irq_work_needs_cpu()) {
> > > > > next_tick = basemono + TICK_NSEC;
> > > > > } else {
> > > > > next_tmr = get_next_timer_interrupt(basejiff,
> > > > > basemono); ts->next_timer = next_tmr;
> > > > > /* Take the next rcu event into account */
> > > > > next_tick = next_rcu < next_tmr ? next_rcu : next_tmr;
> > > > > }
> > > > >
> > > > > Can you please figure out WHY the tick is requested to continue
> > > > > instead of blindly wreckaging the logic in that code?
> > > >
> > > > Looks like the it hits in both cases during forced idle.
> > > > + Josh
> > > > + Paul
> > > >
> > > > For the first case, it is always related to RCU. I found there are two
> > > > CONFIG options to avoid this undesired tick in idle loop.
> > > > 1. enable CONFIG_RCU_NOCB_CPU_ALL, offload to orcu kthreads
> > > > 2. or enable CONFIG_RCU_FAST_NO_HZ (enter dytick idle w/ rcu callback)
> > > >
> > > > Either one works but my concern is that users may not realize the
> > > > intricate CONFIG_ options and how they translate into energy savings.
> > > > Consulted with Josh, it seems we could add a check here to recognize
> > > > the forced idle state and relax rcu_needs_cpu() to return false even it
> > > > has callbacks. Since we are blocking everybody for a short time (5 ticks
> > > > default). It should not impact synchronize and kfree rcu.
> > >
> > > Right; as long as you're blocking *everybody*, and RCU priority boosting
> > > doesn't come into play (meaning a real-time task is waiting on RCU
> > > callbacks), then I don't see any harm in blocking RCU callbacks for a
> > > while. You'd block completion of synchronize_rcu() and similar, as well
> > > as memory reclamation, but since you've blocked *every* CPU systemwide
> > > then that doesn't cause a problem.
> >
> > True enough. But how does RCU distinguish between this being a
> > normal idle cycle that might last indefinitely on the one hand and the
> > five-jiffy system-wide throttling on the other? OK, maybe there is a
> > global variable that says that the just-now-starting idle period is
> > system-wide throttling. But then what about the CPU that just went
> > idle 10 microseconds ago, and therefore left its timer tick running?
> > Fine and well, we could IPI it to wake it up and let it see that we
> > are now doing thermal throttling. But then we presumably also have to
> > IPI it at the end of the thermal-throttling interval in order for it to
> > re-evaluate whether or not it should have the tick going. :-/
> >
> > On the one hand, I am sure that all of this can be made to work,
> > but simply having systems using thermal throttling enable either
> > CONFIG_RCU_NOCB_CPU_ALL or CONFIG_RCU_FAST_NO_HZ seems -way- simpler.
> > CONFIG_RCU_FAST_NO_HZ is probably the better choice for generic workloads,
> > but CONFIG_RCU_NOCB_CPU_ALL is the better choice for embedded workloads
> > where it is less likely that RCU callbacks will be posted with continuous
> > wild abandon.
> >
> > Or am I missing something subtle here?
>
> I agree that it seems preferable to make this require an existing RCU
> solution rather than adding more complexity to the RCU idle path. One
> possible thing that may affect the choice of solution: this needs to
> idle *every* CPU, without leaving any CPU awake to handle callbacks or
> similar.
Fair point. When in the five-jiffy throttling state, what can wake up
a CPU? In an earlier version of this proposal, the answer was "nothing",
but maybe that has changed.
Thanx, Paul
next prev parent reply other threads:[~2015-11-17 2:53 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-13 19:53 [PATCH 0/4] CFS idle injection Jacob Pan
2015-11-13 19:53 ` [PATCH 1/4] ktime: add a roundup function Jacob Pan
2015-11-13 20:11 ` John Stultz
2015-11-13 22:33 ` Jacob Pan
2015-11-13 20:13 ` Thomas Gleixner
2015-11-13 22:36 ` Jacob Pan
2015-11-13 19:53 ` [PATCH 2/4] timer: relax tick stop in idle entry Jacob Pan
2015-11-13 20:22 ` Thomas Gleixner
2015-11-13 22:24 ` Jacob Pan
2015-11-16 15:06 ` Thomas Gleixner
2015-11-16 21:51 ` Jacob Pan
2015-11-16 22:01 ` Thomas Gleixner
2015-11-17 0:09 ` Jacob Pan
2015-11-19 17:43 ` Jacob Pan
2015-11-19 19:06 ` Peter Zijlstra
2015-11-19 19:21 ` Jacob Pan
2015-11-19 19:59 ` Peter Zijlstra
2015-11-19 23:41 ` Jacob Pan
2015-11-16 22:31 ` Paul E. McKenney
2015-11-16 23:05 ` Jacob Pan
2015-11-16 23:15 ` Jacob Pan
2015-11-16 23:28 ` Paul E. McKenney
2015-11-16 23:32 ` Arjan van de Ven
2015-11-16 23:40 ` Jacob Pan
2015-11-17 0:00 ` Paul E. McKenney
2015-11-16 22:32 ` Josh Triplett
2015-11-16 23:26 ` Paul E. McKenney
2015-11-17 1:41 ` Josh Triplett
2015-11-17 2:53 ` Paul E. McKenney [this message]
2015-11-17 2:57 ` Arjan van de Ven
2015-11-17 5:04 ` Paul E. McKenney
2015-11-17 10:24 ` Peter Zijlstra
2015-11-17 12:57 ` Jacob Pan
2015-11-17 13:49 ` Paul E. McKenney
2015-11-13 19:53 ` [PATCH 3/4] sched: introduce synchronized idle injection Jacob Pan
2015-11-13 20:23 ` kbuild test robot
2015-11-18 8:36 ` Ingo Molnar
2015-11-18 10:35 ` Peter Zijlstra
2015-11-18 12:27 ` Morten Rasmussen
2015-11-18 12:49 ` Peter Zijlstra
2015-11-18 14:04 ` Morten Rasmussen
2015-11-18 14:52 ` Jacob Pan
2015-11-18 15:09 ` Morten Rasmussen
2015-11-18 15:11 ` Jacob Pan
2015-11-18 15:21 ` Thomas Gleixner
2015-11-18 17:03 ` Jacob Pan
2015-11-18 16:04 ` Morten Rasmussen
2015-11-27 9:17 ` Ingo Molnar
2015-11-18 14:10 ` Jacob Pan
2015-11-27 9:17 ` Ingo Molnar
2015-12-02 17:28 ` Jacob Pan
2015-11-18 14:19 ` Arjan van de Ven
2015-11-18 15:44 ` Morten Rasmussen
2015-11-18 15:51 ` Arjan van de Ven
2015-11-19 17:24 ` Morten Rasmussen
2015-11-19 20:09 ` Peter Zijlstra
2015-11-20 9:45 ` Thomas Gleixner
2015-11-20 10:20 ` Peter Zijlstra
2015-11-20 10:58 ` Thomas Gleixner
2015-11-20 12:54 ` Peter Zijlstra
2015-11-20 18:53 ` Thomas Gleixner
2016-01-11 21:50 ` Jacob Pan
2016-01-19 12:06 ` Ingo Molnar
2016-01-19 18:00 ` Jacob Pan
2015-11-24 11:38 ` Jacob Pan
2015-11-23 17:59 ` Jacob Pan
2015-11-23 17:56 ` Javi Merino
2015-11-23 18:07 ` Peter Zijlstra
2015-11-24 9:12 ` Javi Merino
2015-11-24 10:09 ` Peter Zijlstra
2015-11-24 11:10 ` Jacob Pan
2015-11-24 12:00 ` Javi Merino
2015-11-24 18:22 ` Jacob Pan
2015-11-25 9:41 ` Javi Merino
2015-11-13 19:53 ` [PATCH 4/4] sched: add trace event for " Jacob Pan
2015-11-13 20:10 ` kbuild test robot
2015-11-19 14:39 ` Javi Merino
2015-11-19 15:35 ` Jacob Pan
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=20151117025342.GP5184@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=arjan@linux.intel.com \
--cc=edubezval@gmail.com \
--cc=jacob.jun.pan@linux.intel.com \
--cc=john.stultz@linaro.org \
--cc=josh@joshtriplett.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=rafael.j.wysocki@intel.com \
--cc=srinivas.pandruvada@linux.intel.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).