public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: kuznet@ms2.inr.ac.ru
Cc: mingo@elte.hu, torvalds@transmeta.com,
	linux-kernel@vger.kernel.org, alan@lxorguk.ukuu.org.uk,
	bcrl@redhat.com, andrea@suse.de
Subject: Re: [patch] softirq performance fixes, cleanups, 2.4.10.
Date: Sat, 29 Sep 2001 21:03:06 +1000	[thread overview]
Message-ID: <20010929210306.7904954e.rusty@rustcorp.com.au> (raw)
In-Reply-To: <200109281618.UAA04122@ms2.inr.ac.ru>
In-Reply-To: <Pine.LNX.4.33.0109261729570.5644-200000@localhost.localdomain> <200109281618.UAA04122@ms2.inr.ac.ru>

On Fri, 28 Sep 2001 20:18:20 +0400 (MSK DST)
kuznet@ms2.inr.ac.ru wrote:

> Also, you did not assure me that you interpret problem correctly.
> netif_rx() is __insensitive__ to latencies due to blocked softirq
restarts.
> It stops spinning only when it becomes true cpu hog. And scheduling
ksoftirqd
> is the only variant here.

Hi Ingo at al,

Attached is the approach I sent to l-k earlier this week: if a timer tick
goes off, back off to ksoftirqd.

This should, statistically, do the right thing, even in the case of smart
softirqs like netif_rx.

Please consider,
Rusty.

--- linux-pmac/kernel/softirq.c	Sun Sep  9 15:11:37 2001
+++ working-pmac-ksoftirq/kernel/softirq.c	Mon Sep 24 09:44:07 2001
@@ -63,11 +63,12 @@
 	int cpu = smp_processor_id();
 	__u32 pending;
 	long flags;
-	__u32 mask;
+	long start;
 
 	if (in_interrupt())
 		return;
 
+	start = jiffies;
 	local_irq_save(flags);
 
 	pending = softirq_pending(cpu);
@@ -75,32 +76,32 @@
 	if (pending) {
 		struct softirq_action *h;
 
-		mask = ~pending;
 		local_bh_disable();
-restart:
-		/* Reset the pending bitmask before enabling irqs */
-		softirq_pending(cpu) = 0;
+		do {
+			/* Reset the pending bitmask before enabling irqs */
+			softirq_pending(cpu) = 0;
 
-		local_irq_enable();
+			local_irq_enable();
 
-		h = softirq_vec;
+			h = softirq_vec;
 
-		do {
-			if (pending & 1)
-				h->action(h);
-			h++;
-			pending >>= 1;
-		} while (pending);
-
-		local_irq_disable();
-
-		pending = softirq_pending(cpu);
-		if (pending & mask) {
-			mask &= ~pending;
-			goto restart;
-		}
+			do {
+				if (pending & 1)
+					h->action(h);
+				h++;
+				pending >>= 1;
+			} while (pending);
+
+			local_irq_disable();
+
+			pending = softirq_pending(cpu);
+
+			/* Don't spin here forever... */
+		} while (pending && start == jiffies);
 		__local_bh_enable();
 
+		/* If a timer tick went off, assume we're overloaded,
+                   and kick in ksoftirqd */
 		if (pending)
 			wakeup_softirqd(cpu);
 	}



  parent reply	other threads:[~2001-09-30 12:41 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-26 16:44 [patch] softirq performance fixes, cleanups, 2.4.10 Ingo Molnar
2001-09-26 17:48 ` Mike Kravetz
2001-09-26 18:48   ` Ingo Molnar
2001-09-26 18:55 ` Russell King
2001-09-26 19:14   ` Ingo Molnar
2001-09-27 23:31 ` Andrea Arcangeli
2001-09-28  3:20   ` Andrea Arcangeli
2001-09-28  7:34     ` Ingo Molnar
2001-09-28 15:17       ` Andrea Arcangeli
2001-09-28  7:18   ` [patch] softirq-2.4.10-B2 Ingo Molnar
2001-09-28 15:58     ` Andrea Arcangeli
2001-09-28 18:36     ` Simon Kirby
2001-09-28 18:47       ` Ingo Molnar
2001-09-28 19:31         ` kuznet
2001-09-28 16:18 ` [patch] softirq performance fixes, cleanups, 2.4.10 kuznet
2001-09-28 16:31   ` Ingo Molnar
2001-09-28 17:04     ` kuznet
2001-09-28 17:21       ` Rik van Riel
2001-09-28 17:31         ` Andrea Arcangeli
2001-09-28 17:41         ` kuznet
2001-09-28 17:46           ` Ingo Molnar
2001-09-28 18:39         ` Josh MacDonald
2001-09-28 17:31       ` Ingo Molnar
2001-09-28 17:56         ` kuznet
2001-09-28 18:28           ` Ingo Molnar
2001-09-28 19:23             ` kuznet
2001-09-28 19:48               ` Ingo Molnar
2001-09-29 16:35                 ` kuznet
2001-09-30  9:37                   ` Kai Henningsen
2001-09-30  9:01               ` Ingo Molnar
2001-09-28 19:39             ` kuznet
2001-09-28 20:03               ` Ingo Molnar
2001-09-28 18:51           ` Benjamin LaHaise
2001-09-28 16:32   ` Andrea Arcangeli
2001-09-28 16:46     ` Ingo Molnar
2001-09-28 16:58       ` Andrea Arcangeli
2001-09-28 16:35   ` [patch] softirq-2.4.10-B3 Ingo Molnar
2001-09-29  0:40     ` J . A . Magallon
2001-09-29 11:03   ` Rusty Russell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-09-27 23:29 [patch] softirq performance fixes, cleanups, 2.4.10 Oleg Nesterov
2001-09-28  0:03 ` Andrea Arcangeli
2001-09-28  6:57 ` Ingo Molnar
2001-09-28  2:50 Oleg Nesterov
2001-09-28  7:56 ` Ingo Molnar

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=20010929210306.7904954e.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andrea@suse.de \
    --cc=bcrl@redhat.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@transmeta.com \
    /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