public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Nikita@namesys.com, akpm@zip.com.au, george@mvista.com,
	andrea@suse.de, rml@tech9.net, Dieter.Nuetzel@hamburg.de,
	mason@suse.com, kuib-kl@ljbc.wa.edu.au,
	linux-kernel@vger.kernel.org, andrea@suse.de
Subject: Re: [reiserfs-list] Re: [PATCH] Significant performace improvements on reiserfs systems
Date: Mon, 24 Sep 2001 09:49:59 +1000	[thread overview]
Message-ID: <20010924094959.4b6725c0.rusty@rustcorp.com.au> (raw)
In-Reply-To: <E15kPGJ-0008EU-00@the-village.bc.nu>
In-Reply-To: <15275.2374.92496.536594@gargle.gargle.HOWL> <E15kPGJ-0008EU-00@the-village.bc.nu>

On Fri, 21 Sep 2001 13:18:31 +0100 (BST)
Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:

> > In Solaris, before spinning on a busy spin-lock, thread checks whether
> > spin-lock holder runs on the same processor. If so, thread goes to sleep
> > and holder wakes it up on spin-lock release. The same, I guess is going
> 
> 
> > for interrupts that are served as separate threads. This way, one can
> > re-schedule with spin-locks held.
> 
> This is one of the things interrupt handling by threads gives you, but the
> performance cost is not nice. When you consider that ksoftirqd when it
> kicks in (currently far too often) takes up to 10% off gigabit ethernet
> performance, you can appreciate why we don't want to go that path.

I've been thinking about this: I know some people have been fiddling with making
do_softirq spin X times before kicking ksoftirqd, but how about the following?

Cheers,
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-23 23:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20010920170812.CCCACE641B@ns1.suse.com>
2001-09-20 17:19 ` [PATCH] Significant performace improvements on reiserfs systems Chris Mason
2001-09-20 17:39   ` Andrew Morton
2001-09-20 20:52     ` Robert Love
2001-09-20 21:11       ` Dieter Nützel
     [not found]       ` <200109202112.f8KLCXG16849@zero.tech9.net>
2001-09-20 22:24         ` Robert Love
2001-09-20 22:37           ` Andrea Arcangeli
2001-09-20 22:56             ` Robert Love
2001-09-20 23:15               ` Andrea Arcangeli
2001-09-20 23:41                 ` Robert Love
2001-09-21  0:37                 ` george anzinger
2001-09-21  1:20                   ` Andrew Morton
2001-09-21  3:14                     ` Robert Love
2001-09-21  9:32                     ` [reiserfs-list] " Nikita Danilov
2001-09-21 12:18                       ` Alan Cox
2001-09-21 12:31                         ` Nikita Danilov
2001-09-23 23:49                         ` Rusty Russell [this message]
2001-09-20 18:47   ` Andrea Arcangeli
2001-09-20 18:58     ` Andrew Morton
2001-09-20 19:13       ` Andrea Arcangeli

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=20010924094959.4b6725c0.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=Dieter.Nuetzel@hamburg.de \
    --cc=Nikita@namesys.com \
    --cc=akpm@zip.com.au \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andrea@suse.de \
    --cc=george@mvista.com \
    --cc=kuib-kl@ljbc.wa.edu.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mason@suse.com \
    --cc=rml@tech9.net \
    /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