From: Viresh Kumar <viresh.kumar@linaro.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Paul McKenney <paulmck@linux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Eric Dumazet <edumazet@google.com>,
John Stultz <john.stultz@linaro.org>,
Joonwoo Park <joonwoop@codeaurora.org>,
Wenbo Wang <wenbo.wang@memblaze.com>,
Steven Rostedt <rostedt@goodmis.org>,
Badhri Jagan Sridharan <Badhri@google.com>
Subject: Re: [patch 4/7] timer: Replace timer base by a cpu index
Date: Wed, 27 May 2015 14:52:36 +0530 [thread overview]
Message-ID: <20150527092236.GC2256@linux> (raw)
In-Reply-To: <20150526224511.950084301@linutronix.de>
On 26-05-15, 22:50, Thomas Gleixner wrote:
> static struct tvec_base *lock_timer_base(struct timer_list *timer,
> unsigned long *flags)
> __acquires(timer->base->lock)
> {
> - struct tvec_base *base;
> -
> for (;;) {
> - struct tvec_base *prelock_base = timer->base;
> - base = tbase_get_base(prelock_base);
> - if (likely(base != NULL)) {
> + u32 tf = timer->flags;
> + struct tvec_base *base;
> +
> + if (!(tf & TIMER_MIGRATING)) {
> + base = per_cpu_ptr(&tvec_bases, tf & TIMER_CPUMASK);
> spin_lock_irqsave(&base->lock, *flags);
> - if (likely(prelock_base == timer->base))
> + if (timer->flags == tf)
> return base;
> - /* The timer has migrated to another CPU */
Maybe we should retain this comment. Its helpful for people who aren't
very familiar with timer core.
> static void migrate_timer_list(struct tvec_base *new_base, struct hlist_head *head)
> {
> struct timer_list *timer;
> + int cpu = new_base->cpu;
>
> while (!hlist_empty(head)) {
> timer = hlist_entry(head->first, struct timer_list, entry);
> /* We ignore the accounting on the dying cpu */
> detach_timer(timer, false);
> - timer_set_base(timer, new_base);
> + timer->flags = (timer->flags & ~TIMER_BASEMASK) | cpu;
Because 'cpu' is used only once in this routine, maybe we can use
'new_base->cpu' here and the line will still be exactly 80 columns
long.
Not sure, but maybe we can create a inline helper for this operation
as it is repeated at multiple places.
Look good otherwise:
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
next prev parent reply other threads:[~2015-05-27 9:22 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-26 22:50 [patch 0/7] timers: Footprint diet and NOHZ overhead mitigation Thomas Gleixner
2015-05-26 22:50 ` [patch 1/7] timers: Sanitize catchup_timer_jiffies() usage Thomas Gleixner
2015-05-27 5:39 ` Viresh Kumar
2015-06-19 13:22 ` [tip:timers/core] " tip-bot for Thomas Gleixner
2015-05-26 22:50 ` [patch 2/7] timer: Remove FIFO guarantee Thomas Gleixner
2015-05-27 9:11 ` Viresh Kumar
2015-06-19 13:22 ` [tip:timers/core] timer: Remove FIFO "guarantee" tip-bot for Thomas Gleixner
2015-05-26 22:50 ` [patch 3/7] timer: Use hlist for the timer wheel hash buckets Thomas Gleixner
2015-05-27 9:13 ` Viresh Kumar
2015-06-19 13:23 ` [tip:timers/core] " tip-bot for Thomas Gleixner
2015-05-26 22:50 ` [patch 4/7] timer: Replace timer base by a cpu index Thomas Gleixner
2015-05-27 9:22 ` Viresh Kumar [this message]
2015-05-27 12:09 ` Peter Zijlstra
2015-06-02 13:58 ` Thomas Gleixner
2015-06-19 13:23 ` [tip:timers/core] " tip-bot for Thomas Gleixner
2015-06-27 9:55 ` [PATCH] timer: Fix unsafe cpu variable access in migrate_timers Jan Kiszka
2015-06-27 11:00 ` Borislav Petkov
2015-06-27 11:19 ` Jan Kiszka
2015-06-27 11:25 ` Borislav Petkov
2015-05-26 22:50 ` [patch 5/7] timer: stats: Simplify the flags handling Thomas Gleixner
2015-06-19 13:23 ` [tip:timers/core] timer: Stats: " tip-bot for Thomas Gleixner
2015-05-26 22:50 ` [patch 6/7] timer: Reduce timer migration overhead if disabled Thomas Gleixner
2015-06-19 13:23 ` [tip:timers/core] " tip-bot for Thomas Gleixner
2015-05-26 22:50 ` [patch 7/7] timer: Minimize nohz off overhead Thomas Gleixner
2015-06-19 13:24 ` [tip:timers/core] " tip-bot for Thomas Gleixner
2015-05-27 14:53 ` [patch 0/7] timers: Footprint diet and NOHZ overhead mitigation Eric Dumazet
2015-06-02 13:58 ` Thomas Gleixner
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=20150527092236.GC2256@linux \
--to=viresh.kumar@linaro.org \
--cc=Badhri@google.com \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=john.stultz@linaro.org \
--cc=joonwoop@codeaurora.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 \
--cc=wenbo.wang@memblaze.com \
/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).