mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Porpoise <porpoise.chiang@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: "Alan Cox" <alan@redhat.com>
Subject: Re: When CONFIG_BASE_SAMLL=1, the kernel 2.6.16.11 (cascade() in kernel/timer.c) may enter the infinite loop.
Date: Thu, 27 Apr 2006 19:21:45 +0800	[thread overview]
Message-ID: <9570b4cc0604270421n37caa3eeq51475ee5b9ce76cc@mail.gmail.com> (raw)
In-Reply-To: <9570b4cc0604270356m36b48173sf443d04ecfa528ec@mail.gmail.com>

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)) {

      reply	other threads:[~2006-04-27 11:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-27 10:56 Porpoise
2006-04-27 11:21 ` Porpoise [this message]

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=9570b4cc0604270421n37caa3eeq51475ee5b9ce76cc@mail.gmail.com \
    --to=porpoise.chiang@gmail.com \
    --cc=alan@redhat.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®