From: Arjan van de Ven <arjan@infradead.org>
To: linux-kernel@vger.kernel.org
Cc: Arjan van de Ven <arjan@infradead.org>,
mingo@elte.hu, peterz@infradead.org
Subject: [PATCH 2/3] hrtimer: make the nanosleep() syscall use the per process slack
Date: Wed, 10 Sep 2008 20:29:40 -0700 [thread overview]
Message-ID: <20080910202940.5f8b3019@infradead.org> (raw)
In-Reply-To: <20080910202803.42b5f251@infradead.org>
From: Arjan van de Ven <arjan@linux.intel.com>
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@linux.intel.com>
---
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
next prev parent reply other threads:[~2008-09-11 3:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-11 3:28 3 further range-hrtimer patches Arjan van de Ven
2008-09-11 3:28 ` [PATCH 1/3] hrtimer: make the futex() system call use the per process slack value Arjan van de Ven
2008-09-11 3:29 ` Arjan van de Ven [this message]
2008-09-11 3:30 ` [PATCH 3/3] hrtimer: peek at the timer queue just before going idle Arjan van de Ven
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=20080910202940.5f8b3019@infradead.org \
--to=arjan@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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