public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes-kernel@saeurebad.de>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] __do_softirq() loop cleanup
Date: Wed, 10 Oct 2007 14:16:19 +0200	[thread overview]
Message-ID: <20071010121619.GA32677@saeurebad.de> (raw)

Hi,

This changes __do_softirq() to use a C looping construct instead of
simulating one by means of goto.

Signed-off-by: Johannes Weiner <hannes-kernel@saeurebad.de>

diff --git a/kernel/softirq.c b/kernel/softirq.c
index 0f546dd..bacee6b 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -212,38 +212,37 @@ asmlinkage void __do_softirq(void)
 	int max_restart = MAX_SOFTIRQ_RESTART;
 	int cpu;
 
-	pending = local_softirq_pending();
 	account_system_vtime(current);
 
 	__local_bh_disable((unsigned long)__builtin_return_address(0));
 	trace_softirq_enter();
 
 	cpu = smp_processor_id();
-restart:
-	/* Reset the pending bitmask before enabling irqs */
-	set_softirq_pending(0);
 
-	local_irq_enable();
+	while ((pending = local_softirq_pending())) {
+		if (!max_restart--) {
+			wakeup_softirqd();
+			break;
+		}
 
-	h = softirq_vec;
+		/* Reset the pending bitmask before enabling irqs */
+		set_softirq_pending(0);
 
-	do {
-		if (pending & 1) {
-			h->action(h);
-			rcu_bh_qsctr_inc(cpu);
-		}
-		h++;
-		pending >>= 1;
-	} while (pending);
+		local_irq_enable();
 
-	local_irq_disable();
+		h = softirq_vec;
 
-	pending = local_softirq_pending();
-	if (pending && --max_restart)
-		goto restart;
+		do {
+			if (pending & 1) {
+				h->action(h);
+				rcu_bh_qsctr_inc(cpu);
+			}
+			h++;
+			pending >>= 1;
+		} while (pending);
 
-	if (pending)
-		wakeup_softirqd();
+		local_irq_disable();
+	}
 
 	trace_softirq_exit();

             reply	other threads:[~2007-10-10 12:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-10 12:16 Johannes Weiner [this message]
2007-10-12  2:26 ` [PATCH] __do_softirq() loop cleanup Steven Rostedt

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=20071010121619.GA32677@saeurebad.de \
    --to=hannes-kernel@saeurebad.de \
    --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