mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Barry Song <21cnbao@gmail.com>
To: mingo@redhat.com, dahlmann.thomas@arcor.de
Cc: linux-kernel@vger.kernel.org,
	uclinux-dist-devel@blackfin.uclinux.org,
	Barry Song <21cnbao@gmail.com>
Subject: [PATCH] Delete redundant IRQ_DISABLED check in irq_thread
Date: Fri, 17 Jul 2009 16:43:49 +0800	[thread overview]
Message-ID: <1247820229-4983-1-git-send-email-21cnbao@gmail.com> (raw)

Signed-off-by: Barry Song <21cnbao@gmail.com>
I think it is completely redundant to check IRQ_DISABLED to decide whether thread_fn will be called.

At first, the irq_thread is waken up by HARDIRQ handler, if IRQ_DISABLED is true, HARDIRQ will have no chance to run, then irq_thread will not run. So there is only a situation that both HARDIRQ can run and IRQ_DISABLED is set.
The case is that the flag is set in the interval of HARDIRQ enter and irq_thread is scheduled to run. I think there is nobody which is interested to disable irq in the interval except HARDIRQ handler itself. Then that causes the second problem I will explain.

Secondly, checking the flag causes some problems in fact. We often call disable_irq_nosync to diable irq in HARDIRQ to avoid flooding irq to follow. But the disable_irq_nosync will set IRQ_DISABLED flag, then that will prevent the execution of thread_fn. That's not the original idea to call disable_irq_nosync in HARDIRQ.

So I guess deleting the check is maybe better and more compact.

-Barry
---
 kernel/irq/manage.c |   17 +----------------
 1 files changed, 1 insertions(+), 16 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 50da676..ff4e05d 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -460,22 +460,7 @@ static int irq_thread(void *data)
 
 		atomic_inc(&desc->threads_active);
 
-		spin_lock_irq(&desc->lock);
-		if (unlikely(desc->status & IRQ_DISABLED)) {
-			/*
-			 * CHECKME: We might need a dedicated
-			 * IRQ_THREAD_PENDING flag here, which
-			 * retriggers the thread in check_irq_resend()
-			 * but AFAICT IRQ_PENDING should be fine as it
-			 * retriggers the interrupt itself --- tglx
-			 */
-			desc->status |= IRQ_PENDING;
-			spin_unlock_irq(&desc->lock);
-		} else {
-			spin_unlock_irq(&desc->lock);
-
-			action->thread_fn(action->irq, action->dev_id);
-		}
+		action->thread_fn(action->irq, action->dev_id);
 
 		wake = atomic_dec_and_test(&desc->threads_active);
 
-- 
1.5.6.3


             reply	other threads:[~2009-07-17  8:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-17  8:43 Barry Song [this message]
2009-07-17 14:13 ` Thomas Gleixner
2009-07-17 14:58   ` Barry Song
2009-07-17 19:01     ` Thomas Gleixner
2009-07-17 23:26       ` Barry Song
2009-07-18  9:41         ` Thomas Gleixner
2009-07-18 14:11           ` Barry Song
2009-07-20  3:52       ` Barry Song
2009-07-20 10:09         ` Thomas Gleixner

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=1247820229-4983-1-git-send-email-21cnbao@gmail.com \
    --to=21cnbao@gmail.com \
    --cc=dahlmann.thomas@arcor.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=uclinux-dist-devel@blackfin.uclinux.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®