linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anton Vorontsov <anton.vorontsov@linaro.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: "Pekka Enberg" <penberg@kernel.org>,
	"Leonid Moiseichuk" <leonid.moiseichuk@nokia.com>,
	"Bartlomiej Zolnierkiewicz" <b.zolnierkie@samsung.com>,
	"Colin Cross" <ccross@android.com>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Davide Libenzi" <davidel@xmailserver.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Ingo Molnar" <mingo@elte.hu>,
	"John Stultz" <john.stultz@linaro.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linaro-kernel@lists.linaro.org, patches@linaro.org,
	kernel-team@android.com
Subject: [PATCH/RFC 0/4] Deferrable timers support for timerfd API
Date: Sat, 1 Sep 2012 22:43:35 -0700	[thread overview]
Message-ID: <20120902054335.GA12741@lizard> (raw)

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(-)

             reply	other threads:[~2012-09-02  5:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-02  5:43 Anton Vorontsov [this message]
2012-09-02  5:45 ` [PATCH 1/4] kernel/time: Add new helpers to convert ktime to/from jiffies Anton Vorontsov
2012-09-02  5:45 ` [PATCH 2/4] timerfd: Move repeated logic into timefd_rearm() Anton Vorontsov
2012-09-02  5:45 ` [PATCH 3/4] timerfd: Factor out timer-type unspecific timerfd_expire() Anton Vorontsov
2012-09-02  5:45 ` [PATCH 4/4] timerfd: Add support for deferrable timers Anton Vorontsov
2012-09-17  5:53 ` [PATCH/RFC 0/4] Deferrable timers support for timerfd API Anton Vorontsov

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=20120902054335.GA12741@lizard \
    --to=anton.vorontsov@linaro.org \
    --cc=akpm@linux-foundation.org \
    --cc=arve@android.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=ccross@android.com \
    --cc=davidel@xmailserver.org \
    --cc=john.stultz@linaro.org \
    --cc=kernel-team@android.com \
    --cc=leonid.moiseichuk@nokia.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=patches@linaro.org \
    --cc=penberg@kernel.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;
as well as URLs for NNTP newsgroup(s).