linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Perevalov <a.perevalov@samsung.com>
To: linux-kernel@vger.kernel.org, tglx@linutronix.de, john.stultz@linaro.org
Cc: Anton Vorontsov <anton@enomsg.org>,
	kyungmin.park@samsung.com, cw00.choi@samsung.com,
	akpm@linux-foundation.org,
	Anton Vorontsov <anton.vorontsov@linaro.org>,
	Alexey Perevalov <a.perevalov@samsung.com>
Subject: [PATCH v4 5/6] timerfd: Add support for deferrable timers
Date: Thu, 20 Feb 2014 20:23:44 +0400	[thread overview]
Message-ID: <1392913425-29369-6-git-send-email-a.perevalov@samsung.com> (raw)
In-Reply-To: <1392913425-29369-1-git-send-email-a.perevalov@samsung.com>

From: Anton Vorontsov <anton@enomsg.org>

This patch 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.

Currently, the implementation is based on high resolution timers. It
provides the same overrun count as for none deferrable timers. What's why
it doesn't not bring any new functionality into timerfd implementation,
except clockid validation.

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Signed-off-by: Alexey Perevalov <a.perevalov@samsung.com>
---
 fs/timerfd.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/timerfd.c b/fs/timerfd.c
index 4a349cb..c132fd2 100644
--- a/fs/timerfd.c
+++ b/fs/timerfd.c
@@ -326,7 +326,10 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
 	    (clockid != CLOCK_MONOTONIC &&
 	     clockid != CLOCK_REALTIME &&
 	     clockid != CLOCK_REALTIME_ALARM &&
-	     clockid != CLOCK_BOOTTIME_ALARM))
+	     clockid != CLOCK_BOOTTIME_ALARM &&
+	     clockid != CLOCK_REALTIME_DEFERRABLE &&
+	     clockid != CLOCK_MONOTONIC_DEFERRABLE &&
+	     clockid != CLOCK_BOOTTIME_DEFERRABLE))
 		return -EINVAL;
 
 	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
@@ -354,7 +357,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
 	return ufd;
 }
 
-static int do_timerfd_settime(int ufd, int flags, 
+static int do_timerfd_settime(int ufd, int flags,
 		const struct itimerspec *new,
 		struct itimerspec *old)
 {
-- 
1.7.9.5


  parent reply	other threads:[~2014-02-20 16:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20 16:23 [PATCH v4 0/6] Deferrable timers support for hrtimers/timerfd API Alexey Perevalov
2014-02-20 16:23 ` [PATCH v4 1/6] Replace ternary operator to macro Alexey Perevalov
2014-02-20 20:49   ` Thomas Gleixner
2014-02-20 16:23 ` [PATCH v4 2/6] tracing/trivial: Add CLOCK_BOOTIME and CLOCK_TAI for human readable clockid trace Alexey Perevalov
2014-02-20 20:49   ` Thomas Gleixner
2014-02-20 16:23 ` [PATCH v4 3/6] hrtimer: Add support for deferrable timer into the hrtimer Alexey Perevalov
2014-02-20 16:23 ` [PATCH v4 4/6] timerfd: Move repeated logic into timerfd_rearm() Alexey Perevalov
2014-02-20 21:13   ` Thomas Gleixner
2014-02-20 16:23 ` Alexey Perevalov [this message]
2014-02-26  2:53   ` [PATCH v4 5/6] timerfd: Add support for deferrable timers Andy Lutomirski
2014-03-04 20:58     ` Thomas Gleixner
2014-03-04 21:53       ` Andy Lutomirski
2014-03-04 22:11         ` Thomas Gleixner
2014-03-04 22:43           ` Andy Lutomirski
2014-03-05  0:10             ` Thomas Gleixner
2014-03-05  0:42               ` Andy Lutomirski
2014-03-05 11:40                 ` Thomas Gleixner
2014-03-05  9:42           ` Richard Cochran
2014-02-20 16:23 ` [PATCH v4 6/6] tracing/trivial: Add CLOCK_*_DEFERRABLE for tracing clockids Alexey Perevalov

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=1392913425-29369-6-git-send-email-a.perevalov@samsung.com \
    --to=a.perevalov@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=anton.vorontsov@linaro.org \
    --cc=anton@enomsg.org \
    --cc=cw00.choi@samsung.com \
    --cc=john.stultz@linaro.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.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).