[PATCH 5/9] remove relative timer from abs_list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When an absolute timer expires, it becomes a relative timer, so remove it from
the abs_list.  The TIMER_ABSTIME flag for timer_settime() changes the
interpretation of the it_value member, but it_interval is always a relative
value and clock_settime() only affects absolute time services.

Signed-off-by: Roman Zippel <[email protected]>

---

 kernel/posix-timers.c |   27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

Index: linux-2.6-mm/kernel/posix-timers.c
===================================================================
--- linux-2.6-mm.orig/kernel/posix-timers.c	2005-11-28 22:31:06.000000000 +0100
+++ linux-2.6-mm/kernel/posix-timers.c	2005-11-28 22:31:08.000000000 +0100
@@ -466,7 +466,7 @@ static int posix_timer_fn(struct ptimer 
 	unsigned long seq;
 	struct timespec delta, new_wall_to;
 	u64 exp = 0;
-	int do_notify = 1, do_restart = 0;
+	int do_restart = 0;
 
 	spin_lock_irqsave(&timr->it_lock, flags);
 	if (!list_empty(&timr->it.real.abs_timer_entry)) {
@@ -491,24 +491,23 @@ static int posix_timer_fn(struct ptimer 
 				   &exp);
 			timr->it.real.wall_to_prev = new_wall_to;
 			timr->it.real.timer.expires += exp;
-			do_notify = 0;
+			spin_unlock(&abs_list.lock);
 			do_restart = 1;
+			goto exit;
 		}
+		list_del_init(&timr->it.real.abs_timer_entry);
 		spin_unlock(&abs_list.lock);
-
 	}
-	if (do_notify)  {
-		if (!timr->it.real.incr)
-			remove_from_abslist(timr);
-		if (!timr->it_requeue_pending) {
-			if (!posix_timer_event(timr, 1))
-				timr->it_requeue_pending = 1;
-			do_restart = schedule_next_timer(timr);
-		} else {
-			timr->it_requeue_pending = 2;
-			timr->it_overrun++;
-		}
+
+	if (!timr->it_requeue_pending) {
+		if (!posix_timer_event(timr, 1))
+			timr->it_requeue_pending = 1;
+		do_restart = schedule_next_timer(timr);
+	} else {
+		timr->it_requeue_pending = 2;
+		timr->it_overrun++;
 	}
+exit:
 	unlock_timer(timr, flags); /* hold thru abs lock to keep irq off */
 
 	return do_restart;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux