From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: John Stultz <john.stultz@linaro.org>,
Peter Zijlstra <peterz@infradead.org>,
Anton Vorontsov <anton@enomsg.org>,
Alexey Perevalov <a.perevalov@samsung.com>,
kyungmin.park@samsung.com, cw00.choi@samsung.com,
Michael Kerrisk <mtk.manpages@gmail.com>
Subject: [RFC patch 5/5] timerfd: Expose deferrable mode to user space
Date: Fri, 21 Feb 2014 17:56:18 -0000 [thread overview]
Message-ID: <20140221174639.888426320@linutronix.de> (raw)
In-Reply-To: <20140221173936.583477951@linutronix.de>
[-- Attachment #1: timerfd-wire-up-deferrables.patch --]
[-- Type: text/plain, Size: 1739 bytes --]
Expose the deferrable timer mode to user space by adding a new
TDF_TIMER_DEFERRABLE flag.
The deferrable mode is available through the syscall timerfd_settime()
by handing in TDF_TIMER_IS_DEFERRABLE via the 'flags' argument.
TFD_TIMER_IS_DEFERRABLE and the other TFD_TIMER_ flags can be ored
together.
If a timer is started with this flag, the expiry of the timer is
relaxed. The timer is guaranteed to not expire before the given expiry
time, but the expiry can be delayed to the point where a non
deferrable timer expires. Deferred timers are not waking up a cpu from
a deep idle period.
Applications using the TFD_TIMER_IS_DEFERRABLE flag work on older kernels
as well, but the timers won't have the deferrable functionality.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
---
fs/timerfd.c | 1 +
include/linux/timerfd.h | 1 +
2 files changed, 2 insertions(+)
Index: tip/fs/timerfd.c
===================================================================
--- tip.orig/fs/timerfd.c
+++ tip/fs/timerfd.c
@@ -166,6 +166,7 @@ static int timerfd_setup(struct timerfd_
htmode = (flags & TFD_TIMER_ABSTIME) ?
HRTIMER_MODE_ABS: HRTIMER_MODE_REL;
+ htmode |= (flags & TFD_TIMER_DEFERRABLE) ? HRTIMER_MODE_DEFERRABLE : 0;
texp = timespec_to_ktime(ktmr->it_value);
ctx->expired = 0;
Index: tip/include/linux/timerfd.h
===================================================================
--- tip.orig/include/linux/timerfd.h
+++ tip/include/linux/timerfd.h
@@ -20,6 +20,7 @@
*/
#define TFD_TIMER_ABSTIME (1 << 0)
#define TFD_TIMER_CANCEL_ON_SET (1 << 1)
+#define TFD_TIMER_DEFERRABLE (2 << 1)
#define TFD_CLOEXEC O_CLOEXEC
#define TFD_NONBLOCK O_NONBLOCK
next prev parent reply other threads:[~2014-02-21 17:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-21 17:56 [RFC patch 0/5] hrtimers: Add deferrable mode Thomas Gleixner
2014-02-21 17:56 ` [RFC patch 1/5] hrtimer: Always check for HRTIMER_MODE_REL Thomas Gleixner
2014-02-25 11:56 ` Peter Zijlstra
2014-02-21 17:56 ` [RFC patch 3/5] hrtimer: Add support for deferrable hrtimers Thomas Gleixner
2014-02-21 17:56 ` [RFC patch 2/5] hrtimer: Make use of the active bases bitfield Thomas Gleixner
2014-02-25 12:01 ` Peter Zijlstra
2014-02-21 17:56 ` [RFC patch 4/5] posix-timers: Expose deferrable mode to user space Thomas Gleixner
2014-02-21 17:56 ` Thomas Gleixner [this message]
2014-02-25 8:36 ` [RFC patch 5/5] timerfd: " Richard Cochran
2014-02-26 3:02 ` [RFC patch 0/5] hrtimers: Add deferrable mode Andy Lutomirski
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=20140221174639.888426320@linutronix.de \
--to=tglx@linutronix.de \
--cc=a.perevalov@samsung.com \
--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=mtk.manpages@gmail.com \
--cc=peterz@infradead.org \
/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®