[PATCH 2/3] hrtimer: make the nanosleep() syscall use the perprocess slack

From: Arjan van de Ven
Date: Wed Sep 10 2008 - 23:31:20 EST



From: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
Subject: [PATCH] hrtimer: make the nanosleep() syscall use the per process slack

This patch makes the nanosleep() system call use the per process
slack value; with this users are able to externally control existing
applications to reduce the wakeup rate.

Signed-off-by: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
---
kernel/hrtimer.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index a022209..9a4c901 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -1563,9 +1563,14 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
struct restart_block *restart;
struct hrtimer_sleeper t;
int ret = 0;
+ unsigned long slack;
+
+ slack = current->timer_slack_ns;
+ if (rt_task(current))
+ slack = 0;

hrtimer_init_on_stack(&t.timer, clockid, mode);
- hrtimer_set_expires(&t.timer, timespec_to_ktime(*rqtp));
+ hrtimer_set_expires_range_ns(&t.timer, timespec_to_ktime(*rqtp), slack);
if (do_nanosleep(&t, mode))
goto out;

--
1.5.5.1



--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/