From: Frederic Weisbecker <fweisbec@gmail.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
John Stultz <john.stultz@linaro.org>,
Alex Shi <alex.shi@linaro.org>, Kevin Hilman <khilman@linaro.org>
Subject: Re: [PATCH 10/13] nohz: Hand over timekeeping duty on cpu offlining
Date: Wed, 18 Dec 2013 15:19:59 +0100 [thread overview]
Message-ID: <20131218141957.GB18464@localhost.localdomain> (raw)
In-Reply-To: <20131217234022.GH19211@linux.vnet.ibm.com>
On Tue, Dec 17, 2013 at 03:40:23PM -0800, Paul E. McKenney wrote:
> > diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
> > index 527b501..94b6901 100644
> > --- a/kernel/time/tick-sched.c
> > +++ b/kernel/time/tick-sched.c
> > @@ -217,6 +217,12 @@ static u64 tick_timekeeping_max_deferment(struct tick_sched *ts)
> > return timekeeping_max_deferment();
> >
> > /*
> > + * Order tick_do_timer_cpu read against the IPI, pairs with
> > + * tick_nohz_full_kick_timekeeping()
> > + */
> > + smp_rmb();
>
> If this is the handler for the smp_send_reschedule(), then the above
> memory barrier is not needed. (See my comment below.)
>
> > +
> > + /*
> > * If we are the timekeeper and all full dynticks CPUs are idle,
> > * then we can finally sleep.
> > */
> > @@ -293,6 +299,22 @@ void tick_nohz_full_kick_all(void)
> > preempt_enable();
> > }
> >
> > +/**
> > + * tick_nohz_full_kick_timekeeping - kick the default timekeeper
> > + *
> > + * kick the default timekeeper when a secondary timekeeper goes offline.
> > + */
> > +void tick_nohz_full_kick_timekeeping(void)
> > +{
> > + tick_do_timer_cpu = tick_timekeeping_default_cpu();
> > + /*
> > + * Order tick_do_timer_cpu against the IPI, pairs with
> > + * tick_timekeeping_max_deferment on irq exit.
> > + */
> > + smp_wmb();
>
> But the IPI is supposed to provide full ordering between the CPU invoking
> the IPI and the IPI handler, right?
Great! I remember you told me so once but I wasn't sure. Thanks for
the confirmation!
> I do not believe that you need
> the above smp_wmb() -- though keeping the comment stating that you are
> relying on the implicit barrier in IPI would be good.
Indeed, I'll keep the comment on what the code rely on concerning implicit
ordering guarantees and then remove the explicit barriers.
>
> > + smp_send_reschedule(tick_timekeeping_default_cpu());
>
> Again, smp_send_reschedule()'s IPI hander does not necessarily do
> anything if there is nothing for the scheduler to do, so any needed
> actions are taking in the return-from-interrupt code?
Yep, this is all handled from irq exit:
irq_exit -> tick_nohz_irq_exit() -> tick_nohz_stop_sched_tick() -> tick_timekeeping_max_deferment()
The latter function performs the tick re-evaluation on top of the need or not for the current
CPU to handle the timekeeping on behalf of others.
Thanks.
>
> > +}
> > +
> > /*
> > * Re-evaluate the need for the tick as we switch the current task.
> > * It might need the tick due to per task/process properties:
> > @@ -351,6 +373,15 @@ static int tick_nohz_cpu_down_callback(struct notifier_block *nfb,
> > if (tick_nohz_full_running && tick_timekeeping_default_cpu() == cpu)
> > return NOTIFY_BAD;
> > break;
> > +
> > + case CPU_DYING:
> > + /*
> > + * Notify default timekeeper if we are giving up
> > + * timekeeping duty
> > + */
> > + if (tick_nohz_full_running && tick_do_timer_cpu == cpu)
> > + tick_nohz_full_kick_timekeeping();
> > + break;
> > }
> > return NOTIFY_OK;
> > }
> > --
> > 1.8.3.1
> >
>
next prev parent reply other threads:[~2013-12-18 14:20 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-17 22:51 [RFC PATCH 00/13] nohz: Use sysidle detection to let the timekeeper sleep Frederic Weisbecker
2013-12-17 22:51 ` [PATCH 01/13] tick: Rename tick_check_idle() to tick_irq_enter() Frederic Weisbecker
2014-01-25 14:22 ` [tip:timers/urgent] " tip-bot for Frederic Weisbecker
2013-12-17 22:51 ` [PATCH 02/13] time: New helper to check CPU eligibility to handle timekeeping Frederic Weisbecker
2013-12-17 22:51 ` [PATCH 03/13] rcu: Exclude all potential timekeepers from sysidle detection Frederic Weisbecker
2013-12-17 23:27 ` Paul E. McKenney
2013-12-17 23:49 ` Frederic Weisbecker
2013-12-18 11:43 ` Peter Zijlstra
2013-12-18 11:46 ` Peter Zijlstra
2013-12-18 14:15 ` Paul E. McKenney
2013-12-18 16:24 ` Frederic Weisbecker
2013-12-17 22:51 ` [PATCH 04/13] tick: Use timekeeping_cpu() to elect the CPU handling timekeeping duty Frederic Weisbecker
2013-12-17 23:55 ` Paul E. McKenney
2013-12-17 22:51 ` [PATCH 05/13] rcu: Fix unraised IPI to timekeeping CPU Frederic Weisbecker
2013-12-17 23:21 ` Paul E. McKenney
2013-12-18 14:13 ` Frederic Weisbecker
2013-12-18 14:22 ` Paul E. McKenney
2013-12-18 14:56 ` Frederic Weisbecker
2013-12-18 15:11 ` Peter Zijlstra
2013-12-18 15:58 ` Frederic Weisbecker
2013-12-18 12:12 ` Peter Zijlstra
2013-12-18 15:38 ` Frederic Weisbecker
2013-12-18 15:45 ` Christoph Hellwig
2013-12-18 17:10 ` Peter Zijlstra
2013-12-17 22:51 ` [PATCH 06/13] nohz: Introduce full dynticks' default timekeeping target Frederic Weisbecker
2013-12-17 23:54 ` Paul E. McKenney
2013-12-17 22:51 ` [PATCH 07/13] sched: Enable IPI reception on timekeeper under nohz full system Frederic Weisbecker
2013-12-17 23:52 ` Paul E. McKenney
2013-12-18 14:49 ` Frederic Weisbecker
2013-12-18 15:50 ` Paul E. McKenney
2013-12-18 10:06 ` Peter Zijlstra
2013-12-17 22:51 ` [PATCH 08/13] nohz: Get timekeeping max deferment outside jiffies_lock Frederic Weisbecker
2014-01-25 14:22 ` [tip:timers/urgent] " tip-bot for Frederic Weisbecker
2013-12-17 22:51 ` [PATCH 09/13] nohz: Allow timekeeper's tick to stop when all full dynticks CPUs are idle Frederic Weisbecker
2013-12-17 23:51 ` Paul E. McKenney
2013-12-18 14:36 ` Frederic Weisbecker
2013-12-18 15:29 ` Paul E. McKenney
2013-12-17 22:51 ` [PATCH 10/13] nohz: Hand over timekeeping duty on cpu offlining Frederic Weisbecker
2013-12-17 23:40 ` Paul E. McKenney
2013-12-18 14:19 ` Frederic Weisbecker [this message]
2013-12-18 12:30 ` Peter Zijlstra
2013-12-18 16:43 ` Frederic Weisbecker
2013-12-17 22:51 ` [PATCH 11/13] nohz: Wake up timekeeper on exit from sysidle state Frederic Weisbecker
2013-12-17 23:34 ` Paul E. McKenney
2013-12-17 23:52 ` Frederic Weisbecker
2013-12-17 22:51 ` [PATCH 12/13] nohz: Allow all CPUs outside nohz_full range to do timekeeping Frederic Weisbecker
2013-12-17 23:32 ` Paul E. McKenney
2013-12-17 22:51 ` [PATCH 13/13] nohz_full: fix code style issue of tick_nohz_full_stop_tick Frederic Weisbecker
2013-12-18 2:04 ` [RFC PATCH 00/13] nohz: Use sysidle detection to let the timekeeper sleep Alex Shi
2013-12-18 10:19 ` Peter Zijlstra
2013-12-18 14:18 ` Paul E. McKenney
2013-12-18 17:43 ` Frederic Weisbecker
2013-12-18 21:29 ` Andy Lutomirski
2013-12-18 21:49 ` Paul E. McKenney
2013-12-18 21:53 ` Andy Lutomirski
2013-12-18 21:57 ` Paul E. McKenney
2013-12-18 22:55 ` Andy Lutomirski
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=20131218141957.GB18464@localhost.localdomain \
--to=fweisbec@gmail.com \
--cc=alex.shi@linaro.org \
--cc=john.stultz@linaro.org \
--cc=khilman@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--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
all inboxes | Powered by JetHome®