Re: When CONFIG_BASE_SAMLL=1, the kernel 2.6.16.11 (cascade() in kernel/timer.c) may enter the infinite loop.

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

 



Dear all,

  Sorry. There is a typo.
  The patch should be "#if CONFIG_BASE_SMALL!=0",
  not "#ifdef CONFIG_BASE_SMALL".

Regards,
Porpoise

============================
--- linux-2.6.16.11org/kernel/timer.c	2006-04-25 04:20:24.000000000 +0800
+++ linux-2.6.16.11/kernel/timer.c	2006-04-27 18:49:55.000000000 +0800
@@ -394,6 +394,34 @@
 EXPORT_SYMBOL(del_timer_sync);
 #endif

+#if CONFIG_BASE_SMALL!=0
+static int cascade_safe(tvec_base_t *base, tvec_t *tv, int index)
+{
+	/* cascade all the timers from tv up one level */
+	struct list_head *head, *curr;
+	struct list_head dummy_head;
+	
+	head = tv->vec + index;
+
+	list_add(&dummy_head,head);
+	list_del_init(head);
+
+	curr = dummy_head.next;
+	while (curr != &dummy_head) {
+		struct timer_list *tmp;
+
+		tmp = list_entry(curr, struct timer_list, entry);
+		BUG_ON(tmp->base != &base->t_base);
+		curr = curr->next;
+		internal_add_timer(base, tmp);
+	}
+
+	return index;
+}
+#else
+#define cascade_safe(base,tv,index) cascade(base,tv,index)
+#endif
+
 static int cascade(tvec_base_t *base, tvec_t *tv, int index)
 {
 	/* cascade all the timers from tv up one level */
@@ -444,7 +472,7 @@
 			(!cascade(base, &base->tv2, INDEX(0))) &&
 				(!cascade(base, &base->tv3, INDEX(1))) &&
 					!cascade(base, &base->tv4, INDEX(2)))
-			cascade(base, &base->tv5, INDEX(3));
+			cascade_safe(base, &base->tv5, INDEX(3));
 		++base->timer_jiffies;
 		list_splice_init(base->tv1.vec + index, &work_list);
 		while (!list_empty(head)) {
-
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