Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Anton Vorontsov <anton.vorontsov <at> linaro.org>
Subject: [PATCH/RFC 0/4] Deferrable timers support for timerfd API
Newsgroups: gmane.linux.kernel
Date: Sunday 2nd September 2012 05:43:35 UTC (over 4 years ago)
Hi all,

This patch set implements a userland-side API for generic deferrable
timers, per linux/timer.h:

 * A deferrable timer will work normally when the system is busy, but
 * will not cause a CPU to come out of idle just to service it; instead,
 * the timer will be serviced when the CPU eventually wakes up with a
 * subsequent non-deferrable timer.

These timers are crucial for power saving, i.e. periodic tasks that want
to work in background when the system is under use, but don't want to
cause wakeups themselves.

The deferred timers are somewhat orthogonal to high-res external timers,
since the deferred timer is tied to the system load, not just to some
external decrementer source.

So, currently, the implementation has a HZ precision, and the maximum
interval is jiffies resolution (i.e. with HZ=1000, on 32 bit that would
be around max 49 days).  Of course we can implement longer timeouts by
rearming the timer, although it probably  wouldn't make much sense in
real world, so we keep it simple and just return E2BIG if we don't like
the interval.

Note that the code is still using time calculation that is done by the
hrtimer routines, so we pretty much reuse everything except for the
timer events themselves (i.e. we use calculation results of
hrtimer_forward_now() and hrtimer_expires_remaining(), but never start
the hrtimer). So the code path is pretty much the same for both hrtimers
and deferrable timers.

We will use the timers to periodically read /proc/vmstat without
forcibly waking up the system; but let's see, maybe there are other use
cases that might be interesting for PM folks.

Thanks!

Anton.

--
 fs/timerfd.c            | 87
+++++++++++++++++++++++++++++++++++++++++++------
 include/linux/jiffies.h |  3 ++
 include/linux/ktime.h   |  3 +-
 include/linux/timerfd.h |  4 ++-
 kernel/time.c           | 23 +++++++++++++
 5 files changed, 108 insertions(+), 12 deletions(-)
 
CD: 18ms