From: Yong Zhang <yong.zhang0@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Nick Bowler <nbowler@elliptictech.com>,
linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>
Subject: [PATCH 1/2] softirq: introduce loacal_bh_enable_force_wake()
Date: Thu, 3 Feb 2011 19:50:56 +0800 [thread overview]
Message-ID: <20110203115056.GA2121@zhy> (raw)
In-Reply-To: <20110203101739.GA1551@zhy>
On Thu, Feb 03, 2011 at 06:17:39PM +0800, Yong Zhang wrote:
> Maybe we can introduce another type of local_bh_enable() in which
> waking up ksoftirqd is forced if needed.
---
From: Yong Zhang <yong.zhang0@gmail.com>
Subject: [PATCH 1/2] softirq: introduce loacal_bh_enable_force_wake()
If there is pending softirq, don't handle it in the caller's
context, invoke ksoftirqd directly instead.
del_timer_sync() will be the first caller.
Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/bottom_half.h | 1 +
kernel/softirq.c | 19 ++++++++++++++-----
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/include/linux/bottom_half.h b/include/linux/bottom_half.h
index 27b1bcf..665d697 100644
--- a/include/linux/bottom_half.h
+++ b/include/linux/bottom_half.h
@@ -5,5 +5,6 @@ extern void local_bh_disable(void);
extern void _local_bh_enable(void);
extern void local_bh_enable(void);
extern void local_bh_enable_ip(unsigned long ip);
+extern void local_bh_enable_force_wake(void);
#endif /* _LINUX_BH_H */
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 68eb5ef..5f224d4 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -154,7 +154,7 @@ void _local_bh_enable(void)
EXPORT_SYMBOL(_local_bh_enable);
-static inline void _local_bh_enable_ip(unsigned long ip)
+static inline void _local_bh_enable_ip(unsigned long ip, bool force_wake)
{
WARN_ON_ONCE(in_irq() || irqs_disabled());
#ifdef CONFIG_TRACE_IRQFLAGS
@@ -171,8 +171,12 @@ static inline void _local_bh_enable_ip(unsigned long ip)
*/
sub_preempt_count(SOFTIRQ_DISABLE_OFFSET - 1);
- if (unlikely(!in_interrupt() && local_softirq_pending()))
- do_softirq();
+ if (unlikely(!in_interrupt() && local_softirq_pending())) {
+ if (!force_wake)
+ do_softirq();
+ else
+ wakeup_softirqd();
+ }
dec_preempt_count();
#ifdef CONFIG_TRACE_IRQFLAGS
@@ -183,16 +187,21 @@ static inline void _local_bh_enable_ip(unsigned long ip)
void local_bh_enable(void)
{
- _local_bh_enable_ip((unsigned long)__builtin_return_address(0));
+ _local_bh_enable_ip((unsigned long)__builtin_return_address(0), false);
}
EXPORT_SYMBOL(local_bh_enable);
void local_bh_enable_ip(unsigned long ip)
{
- _local_bh_enable_ip(ip);
+ _local_bh_enable_ip(ip, false);
}
EXPORT_SYMBOL(local_bh_enable_ip);
+void local_bh_enable_force_wake(void)
+{
+ _local_bh_enable_ip((unsigned long)__builtin_return_address(0), true);
+}
+EXPORT_SYMBOL(local_bh_enable_force_wake);
/*
* We restart softirq processing MAX_SOFTIRQ_RESTART times,
* and we fall back to softirqd after that.
--
1.7.1
next prev parent reply other threads:[~2011-02-03 11:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-03 3:19 Regression: WARNINGS and lockdep spews in 2.6.38-rc3+ (bisected) Nick Bowler
2011-02-03 9:12 ` Yong Zhang
2011-02-03 9:30 ` Peter Zijlstra
2011-02-03 10:17 ` Yong Zhang
2011-02-03 10:33 ` Peter Zijlstra
2011-02-03 11:42 ` Yong Zhang
2011-02-08 16:55 ` Peter Zijlstra
2011-02-08 17:39 ` [PATCH] lockdep/timers: Explain in detail the locking problems del_timer_sync() may cause Steven Rostedt
2011-02-16 13:51 ` [tip:core/locking] " tip-bot for Steven Rostedt
2011-02-03 11:50 ` Yong Zhang [this message]
2011-02-03 11:53 ` [PATCH 2/2] timer: use local_bh_enable_force_wake() in del_timer_sync() Yong Zhang
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=20110203115056.GA2121@zhy \
--to=yong.zhang0@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=nbowler@elliptictech.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.