public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrea Arcangeli <andrea@suse.de>
To: "David S. Miller" <davem@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Subject: Re: [patch] severe softirq handling performance bug, fix, 2.4.5
Date: Sun, 27 May 2001 19:56:19 +0200	[thread overview]
Message-ID: <20010527195619.K676@athlon.random> (raw)
In-Reply-To: <Pine.LNX.4.33.0105261920030.3336-200000@localhost.localdomain> <20010527190700.H676@athlon.random> <15121.13986.987230.445825@pizda.ninka.net>
In-Reply-To: <15121.13986.987230.445825@pizda.ninka.net>; from davem@redhat.com on Sun, May 27, 2001 at 10:17:22AM -0700

On Sun, May 27, 2001 at 10:17:22AM -0700, David S. Miller wrote:
> I still fail to understand, won't the C code in do_IRQ() handle
> this case as well?  What is so special about returning from an
> interrupt to the idle task on x86?  And what about that special'ness
> makes the code at the end of do_IRQ() magically not run?

Nothing special of course, I don't like making it special infact,
everything is fine and nothing changes unless the underlined check
(part of the softirq patch) doesn't trigger:

	if (active) {
		struct softirq_action *h;

restart:
		/* Reset active bitmask before enabling irqs */
		softirq_active(cpu) &= ~active;

		local_irq_enable();

		h = softirq_vec;
		mask &= ~active;

		do {
			if (active & 1)
				h->action(h);
			h++;
			active >>= 1;
		} while (active);

		local_irq_disable();

		active = softirq_active(cpu);
		if ((active &= mask) != 0)
			goto retry;
	}
	if (softirq_active(cpu) & softirq_mask(cpu)) {
	    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I mean everything is fine until the same softirq is marked active again
under do_softirq, in such case neither the do_softirq in do_IRQ will
run it (because we are in the critical section and we hold the per-cpu
locks), nor we will run it again ourself from the underlying do_softirq
to avoid live locking into do_softirq.

When the check triggers the ksoftirq patch just wakeup the kernel daemon
so the softirq flood will be balanced by the scheduler, possibly it
could keep running all the time if the machine is idle, like if we would
not mask &= ~active in the do_softirq, but without risks of live locks
because the scheduler will be fair.

	if (softirq_active(cpu) & softirq_mask(cpu)) {
		/*
		 * we cannot loop indefinitely here to avoid userspace starvation,
		 * but we also don't want to introduce a worst case 1/HZ latency
		 * to the pending events, so lets the scheduler to balance
		 * the irq load for us.
		 */
		struct task_struct * tsk = ksoftirqd_task(cpu);
		if (tsk && tsk->state != TASK_RUNNING)
			wake_up_process(tsk);
	}

> Andrea, I think you are talking about a deeper and different problem.

That is the exactly same problem pointed about by Ingo with the idle
task as far I can tell.

If the machine is idle waiting the next interrupt before running the
softirq is even worse because we definitely waste cpu, it's not only a
latency issue in that case, but the problematic is the same if the
machine is loaded and we don't run the softirq again because it was
marked active under us.

Andrea

  reply	other threads:[~2001-05-27 17:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-26 17:59 [patch] severe softirq handling performance bug, fix, 2.4.5 Ingo Molnar
2001-05-26 19:33 ` [patch] softirq-2.4.5-A1 Ingo Molnar
2001-05-27 17:12   ` Andrea Arcangeli
2001-05-27 19:08     ` Ingo Molnar
2001-05-27 20:05       ` Andrea Arcangeli
2001-05-28  1:17         ` Horst von Brand
2001-05-26 23:55 ` [patch] severe softirq handling performance bug, fix, 2.4.5 David S. Miller
2001-05-27  3:28   ` Albert D. Cahalan
2001-05-27 17:18   ` Andrea Arcangeli
2001-05-27 19:00   ` [patch] softirq-2.4.5-B0 Ingo Molnar
2001-05-27 19:15     ` David S. Miller
2001-05-27 19:19       ` Ingo Molnar
2001-05-27 17:07 ` [patch] severe softirq handling performance bug, fix, 2.4.5 Andrea Arcangeli
2001-05-27 17:17   ` David S. Miller
2001-05-27 17:56     ` Andrea Arcangeli [this message]
2001-05-27 19:05       ` Ingo Molnar
2001-05-27 19:55         ` Andrea Arcangeli
2001-05-27 21:00           ` Ingo Molnar
2001-05-28 19:26             ` kuznet
2001-05-27 19:09       ` David S. Miller
2001-05-27 20:24         ` Andrea Arcangeli
2001-06-10 10:40 ` Rusty Russell

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=20010527195619.K676@athlon.random \
    --to=andrea@suse.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=davem@redhat.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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