68 lines
2.1 KiB
Diff
68 lines
2.1 KiB
Diff
From 6661fe8f9906aa0eded36e7c9e74d39e0383f6b4 Mon Sep 17 00:00:00 2001
|
|
From: Nicholas Mc Guire <der.herr@hofr.at>
|
|
Date: Fri, 6 Dec 2013 00:42:22 +0100
|
|
Subject: [PATCH] softirq: make migrate disable/enable conditioned on softirq_nestcnt
|
|
transition
|
|
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.0/patches-4.0.5-rt3.tar.xz
|
|
|
|
This patch removes the recursive calls to migrate_disable/enable in
|
|
local_bh_disable/enable
|
|
|
|
the softirq-local-lock.patch introduces local_bh_disable/enable wich
|
|
decrements/increments the current->softirq_nestcnt and disable/enables
|
|
migration as well. as softirq_nestcnt (include/linux/sched.h conditioned
|
|
on CONFIG_PREEMPT_RT_BASE) already is tracking the nesting level of the
|
|
recursive calls to local_bh_disable/enable (all in kernel/softirq.c) - no
|
|
need to do it twice.
|
|
|
|
migrate_disable/enable thus can be conditionsed on softirq_nestcnt making
|
|
a transition from 0-1 to disable migration and 1-0 to re-enable it.
|
|
|
|
No change of functional behavior, this does noticably reduce the observed
|
|
nesting level of migrate_disable/enable
|
|
|
|
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
|
|
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
|
|
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|
---
|
|
kernel/softirq.c | 14 ++++++++------
|
|
1 file changed, 8 insertions(+), 6 deletions(-)
|
|
|
|
--- a/kernel/softirq.c
|
|
+++ b/kernel/softirq.c
|
|
@@ -557,8 +557,8 @@ static void do_current_softirqs(int need
|
|
|
|
static void __local_bh_disable(void)
|
|
{
|
|
- migrate_disable();
|
|
- current->softirq_nestcnt++;
|
|
+ if (++current->softirq_nestcnt == 1)
|
|
+ migrate_disable();
|
|
}
|
|
|
|
void local_bh_disable(void)
|
|
@@ -584,8 +584,8 @@ static void __local_bh_enable(void)
|
|
do_current_softirqs(1);
|
|
local_irq_enable();
|
|
|
|
- current->softirq_nestcnt--;
|
|
- migrate_enable();
|
|
+ if (--current->softirq_nestcnt == 0)
|
|
+ migrate_enable();
|
|
}
|
|
|
|
void local_bh_enable(void)
|
|
@@ -609,8 +609,10 @@ EXPORT_SYMBOL(local_bh_enable_ip);
|
|
|
|
void _local_bh_enable(void)
|
|
{
|
|
- current->softirq_nestcnt--;
|
|
- migrate_enable();
|
|
+ if (WARN_ON(current->softirq_nestcnt == 0))
|
|
+ return;
|
|
+ if (--current->softirq_nestcnt == 0)
|
|
+ migrate_enable();
|
|
}
|
|
EXPORT_SYMBOL(_local_bh_enable);
|
|
|