mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Andrew Morton <akpm@osdl.org>
Cc: Thomas Gleixner <tglx@linutronix.de>, linux-kernel@vger.kernel.org
Subject: [patch] high-res timers: core, do itimer rearming in process context, fix
Date: Tue, 19 Dec 2006 22:16:29 +0100	[thread overview]
Message-ID: <20061219211629.GA10586@elte.hu> (raw)

Subject: [patch] high-res timers: core, do itimer rearming in process context, fix
From: Ingo Molnar <mingo@elte.hu>

restart itimers when they are not queued. (a non-queued hrtimer might
be callback-pending - but in that case we already missed the rearming
so the SIGALRM branch has to rearm.)

this fixes a threaded itimers stress-test hang.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/hrtimer.h |    9 +++++++++
 kernel/hrtimer.c        |    9 ---------
 kernel/signal.c         |    2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

Index: linux/include/linux/hrtimer.h
===================================================================
--- linux.orig/include/linux/hrtimer.h
+++ linux/include/linux/hrtimer.h
@@ -309,6 +309,15 @@ static inline int hrtimer_active(const s
 	return timer->state != HRTIMER_STATE_INACTIVE;
 }
 
+/*
+ * Helper function to check, whether the timer is on one of the queues
+ */
+static inline int hrtimer_is_queued(struct hrtimer *timer)
+{
+	return timer->state &
+		(HRTIMER_STATE_ENQUEUED | HRTIMER_STATE_PENDING);
+}
+
 /* Forward a hrtimer so it expires after now: */
 extern unsigned long
 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval);
Index: linux/kernel/hrtimer.c
===================================================================
--- linux.orig/kernel/hrtimer.c
+++ linux/kernel/hrtimer.c
@@ -152,15 +152,6 @@ static void hrtimer_get_softirq_time(str
 }
 
 /*
- * Helper function to check, whether the timer is on one of the queues
- */
-static inline int hrtimer_is_queued(struct hrtimer *timer)
-{
-	return timer->state &
-		(HRTIMER_STATE_ENQUEUED | HRTIMER_STATE_PENDING);
-}
-
-/*
  * Helper function to check, whether the timer is running the callback
  * function
  */
Index: linux/kernel/signal.c
===================================================================
--- linux.orig/kernel/signal.c
+++ linux/kernel/signal.c
@@ -475,7 +475,7 @@ int dequeue_signal(struct task_struct *t
 		if (unlikely(signr == SIGALRM)) {
 			struct hrtimer *tmr = &tsk->signal->real_timer;
 
-			if (!hrtimer_active(tmr) &&
+			if (!hrtimer_is_queued(tmr) &&
 			    tsk->signal->it_real_incr.tv64 != 0) {
 				hrtimer_forward(tmr, hrtimer_cb_get_time(tmr),
 						tsk->signal->it_real_incr);

             reply	other threads:[~2006-12-19 21:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-19 21:16 Ingo Molnar [this message]
2006-12-21  7:15 ` [patch] high-res timers: core, do itimer rearming in process context, fix2 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=20061219211629.GA10586@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@osdl.org \
    --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

all inboxes | Powered by JetHome®