From: Thomas Gleixner <tglx@linutronix.de>
To: Andrew Morton <akpm@osdl.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
Roman Zippel <zippel@linux-m68k.org>
Subject: [patch 2/8] Pass current time to hrtimer_forward()
Date: Sun, 12 Mar 2006 10:37:14 -0000 [thread overview]
Message-ID: <20060312080331.805387000@localhost.localdomain> (raw)
In-Reply-To: 20060312080316.826824000@localhost.localdomain
[-- Attachment #1: hrtimer-forward-remove-get-time.patch --]
[-- Type: text/plain, Size: 4225 bytes --]
From: Roman Zippel <zippel@linux-m68k.org>
Pass current time to hrtimer_forward(). This allows to use the softirq
time in the timer base when the forward function is called from the
timer callback. Other places pass current time with a call to
timer->base->get_time().
Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/linux/hrtimer.h | 3 ++-
kernel/hrtimer.c | 7 +++----
kernel/itimer.c | 3 ++-
kernel/posix-timers.c | 14 ++++++++++----
4 files changed, 17 insertions(+), 10 deletions(-)
Index: linux-2.6.16-updates/include/linux/hrtimer.h
===================================================================
--- linux-2.6.16-updates.orig/include/linux/hrtimer.h
+++ linux-2.6.16-updates/include/linux/hrtimer.h
@@ -130,7 +130,8 @@ static inline int hrtimer_active(const s
}
/* Forward a hrtimer so it expires after now: */
-extern unsigned long hrtimer_forward(struct hrtimer *timer, ktime_t interval);
+extern unsigned long
+hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval);
/* Precise sleep: */
extern long hrtimer_nanosleep(struct timespec *rqtp,
Index: linux-2.6.16-updates/kernel/hrtimer.c
===================================================================
--- linux-2.6.16-updates.orig/kernel/hrtimer.c
+++ linux-2.6.16-updates/kernel/hrtimer.c
@@ -301,18 +301,17 @@ void unlock_hrtimer_base(const struct hr
* hrtimer_forward - forward the timer expiry
*
* @timer: hrtimer to forward
+ * @now: forward past this time
* @interval: the interval to forward
*
* Forward the timer expiry so it will expire in the future.
* Returns the number of overruns.
*/
unsigned long
-hrtimer_forward(struct hrtimer *timer, ktime_t interval)
+hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval)
{
unsigned long orun = 1;
- ktime_t delta, now;
-
- now = timer->base->get_time();
+ ktime_t delta;
delta = ktime_sub(now, timer->expires);
Index: linux-2.6.16-updates/kernel/itimer.c
===================================================================
--- linux-2.6.16-updates.orig/kernel/itimer.c
+++ linux-2.6.16-updates/kernel/itimer.c
@@ -136,7 +136,8 @@ int it_real_fn(void *data)
if (tsk->signal->it_real_incr.tv64 != 0) {
hrtimer_forward(&tsk->signal->real_timer,
- tsk->signal->it_real_incr);
+ tsk->signal->real_timer.base->softirq_time,
+ tsk->signal->it_real_incr);
return HRTIMER_RESTART;
}
Index: linux-2.6.16-updates/kernel/posix-timers.c
===================================================================
--- linux-2.6.16-updates.orig/kernel/posix-timers.c
+++ linux-2.6.16-updates/kernel/posix-timers.c
@@ -250,15 +250,18 @@ __initcall(init_posix_timers);
static void schedule_next_timer(struct k_itimer *timr)
{
+ struct hrtimer *timer = &timr->it.real.timer;
+
if (timr->it.real.interval.tv64 == 0)
return;
- timr->it_overrun += hrtimer_forward(&timr->it.real.timer,
+ timr->it_overrun += hrtimer_forward(timer, timer->base->get_time(),
timr->it.real.interval);
+
timr->it_overrun_last = timr->it_overrun;
timr->it_overrun = -1;
++timr->it_requeue_pending;
- hrtimer_restart(&timr->it.real.timer);
+ hrtimer_restart(timer);
}
/*
@@ -333,6 +336,7 @@ EXPORT_SYMBOL_GPL(posix_timer_event);
static int posix_timer_fn(void *data)
{
struct k_itimer *timr = data;
+ struct hrtimer *timer = &timr->it.real.timer;
unsigned long flags;
int si_private = 0;
int ret = HRTIMER_NORESTART;
@@ -350,7 +354,8 @@ static int posix_timer_fn(void *data)
*/
if (timr->it.real.interval.tv64 != 0) {
timr->it_overrun +=
- hrtimer_forward(&timr->it.real.timer,
+ hrtimer_forward(timer,
+ timer->base->softirq_time,
timr->it.real.interval);
ret = HRTIMER_RESTART;
}
@@ -621,7 +626,8 @@ common_timer_get(struct k_itimer *timr,
if (timr->it_requeue_pending & REQUEUE_PENDING ||
(timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE) {
timr->it_overrun +=
- hrtimer_forward(timer, timr->it.real.interval);
+ hrtimer_forward(timer, timer->base->get_time(),
+ timr->it.real.interval);
remaining = hrtimer_get_remaining(timer);
}
calci:
--
next prev parent reply other threads:[~2006-03-12 10:37 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-12 10:37 [patch 0/8] hrtimer updates Thomas Gleixner
2006-03-12 10:37 ` [patch 1/8] hrtimer optimize softirq runqueues Thomas Gleixner
2006-03-12 10:37 ` Thomas Gleixner [this message]
2006-03-12 10:37 ` [patch 3/8] posix-timer cleanup common_timer_get() Thomas Gleixner
2006-03-12 10:37 ` [patch 4/8] hrtimer simplify nanosleep Thomas Gleixner
2006-03-12 10:37 ` [patch 5/8] hrtimer remove state field Thomas Gleixner
2006-03-12 12:13 ` Roman Zippel
2006-03-12 13:10 ` Thomas Gleixner
2006-03-12 13:26 ` Roman Zippel
2006-03-12 13:35 ` Thomas Gleixner
2006-03-12 13:55 ` Roman Zippel
2006-03-12 14:15 ` Thomas Gleixner
2006-03-12 14:30 ` Roman Zippel
2006-03-12 14:54 ` Thomas Gleixner
2006-03-12 15:17 ` Roman Zippel
2006-03-12 15:41 ` Thomas Gleixner
2006-03-12 16:00 ` Roman Zippel
2006-03-12 16:26 ` Thomas Gleixner
2006-03-12 16:57 ` [patch] hrtimer remove replace state check by BUG_ON Thomas Gleixner
2006-03-16 1:05 ` [patch 5/8] hrtimer remove state field Roman Zippel
2006-03-16 9:01 ` Thomas Gleixner
2006-03-17 22:07 ` Roman Zippel
2006-03-18 8:46 ` Thomas Gleixner
2006-03-12 10:37 ` [patch 6/8] Remove it_real_value calculation from proc/*/stat Thomas Gleixner
2006-03-12 10:37 ` [patch 7/8] Remove DEFINE_KTIME and ktime_to_clock_t() Thomas Gleixner
2006-03-12 10:37 ` [patch 8/8] Remove nsec_t typedef Thomas Gleixner
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=20060312080331.805387000@localhost.localdomain \
--to=tglx@linutronix.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=zippel@linux-m68k.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