From: Peter Zijlstra <peterz@infradead.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Eric Dumazet <edumazet@google.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Chris Mason <clm@fb.com>, Arjan van de Ven <arjan@infradead.org>,
rt@linutronix.de
Subject: Re: [patch 13/20] timer: Switch to a non cascading wheel
Date: Mon, 13 Jun 2016 13:40:05 +0200 [thread overview]
Message-ID: <20160613114005.GY30909@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20160613075929.282143900@linutronix.de>
On Mon, Jun 13, 2016 at 08:41:00AM -0000, Thomas Gleixner wrote:
> + * HZ 1000
> + * Level Offset Granularity Range
> + * 0 0 1 ms 0 ms - 63 ms
> + * 1 64 8 ms 64 ms - 511 ms
> + * 2 128 64 ms 512 ms - 4095 ms (512ms - ~4s)
> + * 3 192 512 ms 4096 ms - 32767 ms (~4s - ~32s)
> + * 4 256 4096 ms (~4s) 32768 ms - 262143 ms (~32s - ~4m)
> + * 5 320 32768 ms (~32s) 262144 ms - 2097151 ms (~4m - ~34m)
> +static int collect_expired_timers(struct timer_base *base,
> + struct hlist_head *heads)
> +{
> + unsigned long clock = base->clk;
> + struct hlist_head tmp, *vec;
> + int i, levels = 0;
> + unsigned int idx;
> +
> + /* Expire the regular buckets */
> + for (i = 0; i < LVL_DEPTH - 1; i++) {
> + idx = (clock & LVL_MASK) + i * LVL_SIZE;
> +
> + if (__test_and_clear_bit(idx, base->pending_map)) {
> + vec = base->vectors + idx;
> + hlist_move_list(vec, heads++);
> + levels++;
> + }
> + /* Is it time to look at the next level? */
> + if (clock & LVL_CLK_MASK)
> + return levels;
> + /* Shift clock for the next level granularity */
> + clock >>= LVL_CLK_SHIFT;
> + }
> +
> + /* Cascading, sigh... */
So given that userspace has no influence on timer period; can't we
simply fail to support timers longer than 30 minutes?
In anything really arming timers _that_ long?
> + idx = (clock & LVL_MASK) + i * LVL_SIZE;
> +
> + if (__test_and_clear_bit(idx, base->pending_map)) {
> + vec = base->vectors + idx;
> + hlist_move_list(vec, &tmp);
> + /* Make sure we queue them in the future */
> + base->clk++;
> + while (!hlist_empty(&tmp)) {
> + struct timer_list *timer;
> +
> + timer = hlist_entry(tmp.first, struct timer_list, entry);
> + trace_timer_cascade(timer);
> + __hlist_del(&timer->entry);
> + __internal_add_timer(base, timer);
> + }
> + base->clk--;
> + }
> + return levels;
> +}
next prev parent reply other threads:[~2016-06-13 11:40 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-13 8:40 [patch 00/20] timer: Refactor the timer wheel Thomas Gleixner
2016-06-13 8:40 ` [patch 01/20] timer: Make pinned a timer property Thomas Gleixner
2016-06-13 8:40 ` [patch 02/20] x86/apic/uv: Initialize timer as pinned Thomas Gleixner
2016-06-13 8:40 ` [patch 03/20] x86/mce: " Thomas Gleixner
2016-06-13 8:40 ` [patch 04/20] cpufreq/powernv: " Thomas Gleixner
2016-06-13 13:18 ` Arjan van de Ven
2016-06-13 8:40 ` [patch 05/20] driver/net/ethernet/tile: " Thomas Gleixner
2016-06-13 8:40 ` [patch 06/20] drivers/tty/metag_da: " Thomas Gleixner
2016-06-13 13:13 ` Arjan van de Ven
2016-06-13 8:40 ` [patch 07/20] drivers/tty/mips_ejtag: " Thomas Gleixner
2016-06-13 8:40 ` [patch 08/20] net/ipv4/inet: Initialize timers " Thomas Gleixner
2016-06-13 8:40 ` [patch 09/20] timer: Remove mod_timer_pinned Thomas Gleixner
2016-06-13 8:40 ` [patch 10/20] timer: Add a cascading tracepoint Thomas Gleixner
2016-06-13 8:40 ` [patch 11/20] hlist: Add hlist_is_last_node() helper Thomas Gleixner
2016-06-13 10:27 ` Paolo Bonzini
2016-06-13 8:40 ` [patch 12/20] timer: Give a few structs and members proper names Thomas Gleixner
2016-06-13 8:41 ` [patch 13/20] timer: Switch to a non cascading wheel Thomas Gleixner
2016-06-13 11:40 ` Peter Zijlstra [this message]
2016-06-13 12:30 ` Thomas Gleixner
2016-06-13 12:46 ` Eric Dumazet
2016-06-13 14:30 ` Thomas Gleixner
2016-06-14 10:11 ` Ingo Molnar
2016-06-14 16:28 ` Thomas Gleixner
2016-06-14 17:14 ` Arjan van de Ven
2016-06-14 18:05 ` Thomas Gleixner
2016-06-14 20:34 ` Peter Zijlstra
2016-06-14 20:42 ` Peter Zijlstra
2016-06-14 21:17 ` Eric Dumazet
2016-06-15 14:53 ` Thomas Gleixner
2016-06-15 14:55 ` Arjan van de Ven
2016-06-15 16:43 ` Thomas Gleixner
2016-06-16 15:43 ` Thomas Gleixner
2016-06-16 16:02 ` Paul E. McKenney
2016-06-16 18:14 ` Peter Zijlstra
2016-06-17 0:40 ` Paul E. McKenney
2016-06-17 4:04 ` Paul E. McKenney
2016-06-16 16:04 ` Arjan van de Ven
2016-06-16 16:09 ` Thomas Gleixner
2016-06-15 15:05 ` Eric Dumazet
2016-06-13 14:36 ` Richard Cochran
2016-06-13 14:39 ` Thomas Gleixner
2016-06-13 8:41 ` [patch 15/20] timer: Move __run_timers() function Thomas Gleixner
2016-06-13 8:41 ` [patch 14/20] timer: Remove slack leftovers Thomas Gleixner
2016-06-13 8:41 ` [patch 16/20] timer: Optimize collect timers for NOHZ Thomas Gleixner
2016-06-13 8:41 ` [patch 17/20] tick/sched: Remove pointless empty function Thomas Gleixner
2016-06-13 8:41 ` [patch 18/20] timer: Forward wheel clock whenever possible Thomas Gleixner
2016-06-13 15:14 ` Richard Cochran
2016-06-13 15:18 ` Thomas Gleixner
2016-06-13 8:41 ` [patch 19/20] timer: Split out index calculation Thomas Gleixner
2016-06-13 8:41 ` [patch 20/20] timer: Optimization for same expiry time in mod_timer() Thomas Gleixner
2016-06-13 14:10 ` [patch 00/20] timer: Refactor the timer wheel Eric Dumazet
2016-06-13 16:15 ` Paul E. McKenney
2016-06-15 15:15 ` Paul E. McKenney
2016-06-15 17:02 ` Thomas Gleixner
2016-06-15 20:26 ` Paul E. McKenney
2016-06-14 8:16 [patch 13/20] timer: Switch to a non cascading wheel George Spelvin
2016-06-14 8:50 ` Thomas Gleixner
2016-06-14 10:15 ` George Spelvin
2016-06-14 10:20 ` Peter Zijlstra
2016-06-14 12:58 ` George Spelvin
2016-06-14 16:48 ` Thomas Gleixner
2016-06-14 19:56 ` George Spelvin
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=20160613114005.GY30909@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=arjan@infradead.org \
--cc=clm@fb.com \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=rt@linutronix.de \
--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).