From: Thomas Gleixner <tglx@linutronix.de>
To: Arjan van de Ven <arjan@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org, alan@linux.intel.com
Subject: Re: [patch] timer: Add a mod_timer_msec() API function
Date: Mon, 23 Nov 2009 18:19:20 +0100 (CET) [thread overview]
Message-ID: <alpine.LFD.2.00.0911231728200.24119@localhost.localdomain> (raw)
In-Reply-To: <20091123065108.1fd78779@infradead.org>
On Mon, 23 Nov 2009, Arjan van de Ven wrote:
> On Mon, 23 Nov 2009 09:26:48 +0100
> Ingo Molnar <mingo@elte.hu> wrote:
> >
> > This code first rounds to 1 second - and if that doesnt fall within
> > the slack window it rounds to the (rather aribtrary) rounding of 16
> > jiffies.
> >
> > I'd suggest to use up the slack to its maximum, by rounding up modulo
> > the largest power-of-2 value that still fits into the slack.
> >
> > So if slack is 30, the rounding is 16. If slack is 5, the rounding is
> > 4, etc.
>
> well.. the point of the rounding is that there is a maximum likelyhood
> that OTHER timers align.
>
> I suppose what you suggest would do that too; need to think of a clever
> way to not make that expensive
> (after coffee I'll look at if xor + find first bit will work ;-)
I think we need to rethink the timer wheel subsystem in general
instead of adding more and more fancy interfaces.
Looking at the examples you provided for mod_timer_msec() I noticed
that most of the slack values you chose are between 10% and 20% of the
timeout.
That means the larger the timeout the less interesting is the accuracy
which makes a lot of sense.
I really wonder whether there is any timer_list user which has the
need for large and precise timeouts. If not we could simplify the
whole timer wheel business radically and get rid of the worst thing in
it: recascading.
That's what I have in mind:
timeout accuracy
array0 < 0.256 s 1 ms
array1 < 2.560 s 40 ms
array2 < 25.600 s 400 ms
array3 < 256.000 s 4000 ms
array4 >= 256.000 s 40000 ms
Similar to the current timer wheel, but instead of recascading on
every wraparound of the array0 index we could expire the timers in
array1-4 in their accuracy interval which aligns them automatically
without any slack and rounding business on timer insertion.
The exact array definitions need of course more thought, but you get
the idea.
Such an implementation would also simplify the search for the next
expiring timer as we could keep track of empty/non-empty buckets with
an additional per array bitfield.
If there are a few timers which really need large and precise timeouts
its easy enough to switch them over to hrtimers.
Thoughts ?
Thanks,
tglx
next prev parent reply other threads:[~2009-11-23 17:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-22 23:41 Arjan van de Ven
2009-11-22 23:42 ` Arjan van de Ven
2009-11-23 8:26 ` Ingo Molnar
2009-11-23 14:51 ` Arjan van de Ven
2009-11-23 17:19 ` Thomas Gleixner [this message]
2009-11-24 10:14 ` Alan Cox
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=alpine.LFD.2.00.0911231728200.24119@localhost.localdomain \
--to=tglx@linutronix.de \
--cc=alan@linux.intel.com \
--cc=arjan@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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®