106 lines
2.7 KiB
Diff
106 lines
2.7 KiB
Diff
Subject: softirq-split-out-code.patch
|
|
From: Thomas Gleixner <tglx@linutronix.de>
|
|
Date: Tue, 28 Jun 2011 15:46:49 +0200
|
|
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.0/patches-4.0.5-rt3.tar.xz
|
|
|
|
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|
---
|
|
kernel/softirq.c | 70 +++++++++++++++++++++++++++++--------------------------
|
|
1 file changed, 38 insertions(+), 32 deletions(-)
|
|
|
|
--- a/kernel/softirq.c
|
|
+++ b/kernel/softirq.c
|
|
@@ -77,6 +77,43 @@ static void wakeup_softirqd(void)
|
|
wake_up_process(tsk);
|
|
}
|
|
|
|
+static void handle_pending_softirqs(u32 pending)
|
|
+{
|
|
+ struct softirq_action *h = softirq_vec;
|
|
+ int softirq_bit;
|
|
+
|
|
+ local_irq_enable();
|
|
+
|
|
+ h = softirq_vec;
|
|
+
|
|
+ while ((softirq_bit = ffs(pending))) {
|
|
+ unsigned int vec_nr;
|
|
+ int prev_count;
|
|
+
|
|
+ h += softirq_bit - 1;
|
|
+
|
|
+ vec_nr = h - softirq_vec;
|
|
+ prev_count = preempt_count();
|
|
+
|
|
+ kstat_incr_softirqs_this_cpu(vec_nr);
|
|
+
|
|
+ trace_softirq_entry(vec_nr);
|
|
+ h->action(h);
|
|
+ trace_softirq_exit(vec_nr);
|
|
+ if (unlikely(prev_count != preempt_count())) {
|
|
+ pr_err("huh, entered softirq %u %s %p with preempt_count %08x, exited with %08x?\n",
|
|
+ vec_nr, softirq_to_name[vec_nr], h->action,
|
|
+ prev_count, preempt_count());
|
|
+ preempt_count_set(prev_count);
|
|
+ }
|
|
+ h++;
|
|
+ pending >>= softirq_bit;
|
|
+ }
|
|
+
|
|
+ rcu_bh_qs();
|
|
+ local_irq_disable();
|
|
+}
|
|
+
|
|
/*
|
|
* preempt_count and SOFTIRQ_OFFSET usage:
|
|
* - preempt_count is changed by SOFTIRQ_OFFSET on entering or leaving
|
|
@@ -232,10 +269,8 @@ asmlinkage __visible void __do_softirq(v
|
|
unsigned long end = jiffies + MAX_SOFTIRQ_TIME;
|
|
unsigned long old_flags = current->flags;
|
|
int max_restart = MAX_SOFTIRQ_RESTART;
|
|
- struct softirq_action *h;
|
|
bool in_hardirq;
|
|
__u32 pending;
|
|
- int softirq_bit;
|
|
|
|
/*
|
|
* Mask out PF_MEMALLOC s current task context is borrowed for the
|
|
@@ -254,36 +289,7 @@ asmlinkage __visible void __do_softirq(v
|
|
/* Reset the pending bitmask before enabling irqs */
|
|
set_softirq_pending(0);
|
|
|
|
- local_irq_enable();
|
|
-
|
|
- h = softirq_vec;
|
|
-
|
|
- while ((softirq_bit = ffs(pending))) {
|
|
- unsigned int vec_nr;
|
|
- int prev_count;
|
|
-
|
|
- h += softirq_bit - 1;
|
|
-
|
|
- vec_nr = h - softirq_vec;
|
|
- prev_count = preempt_count();
|
|
-
|
|
- kstat_incr_softirqs_this_cpu(vec_nr);
|
|
-
|
|
- trace_softirq_entry(vec_nr);
|
|
- h->action(h);
|
|
- trace_softirq_exit(vec_nr);
|
|
- if (unlikely(prev_count != preempt_count())) {
|
|
- pr_err("huh, entered softirq %u %s %p with preempt_count %08x, exited with %08x?\n",
|
|
- vec_nr, softirq_to_name[vec_nr], h->action,
|
|
- prev_count, preempt_count());
|
|
- preempt_count_set(prev_count);
|
|
- }
|
|
- h++;
|
|
- pending >>= softirq_bit;
|
|
- }
|
|
-
|
|
- rcu_bh_qs();
|
|
- local_irq_disable();
|
|
+ handle_pending_softirqs(pending);
|
|
|
|
pending = local_softirq_pending();
|
|
if (pending) {
|