2011-02-02 16:11:13

by Thomas Gleixner

[permalink] [raw]
Subject: [PATCH] softirq: Avoid stack switch from ksoftirqd

ksoftirqd() calls do_softirq() which switches stacks on several
architectures. That makes no sense at all. ksoftirqd's stack is
sufficient.

Call __do_softirq() directly.

Signed-off-by: Thomas Gleixner <[email protected]>
---
kernel/softirq.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Index: linux-2.6-tip/kernel/softirq.c
===================================================================
--- linux-2.6-tip.orig/kernel/softirq.c
+++ linux-2.6-tip/kernel/softirq.c
@@ -738,7 +738,10 @@ static int run_ksoftirqd(void * __bind_c
don't process */
if (cpu_is_offline((long)__bind_cpu))
goto wait_to_die;
- do_softirq();
+ local_irq_disable();
+ if (local_softirq_pending())
+ __do_softirq();
+ local_irq_enable();
preempt_enable_no_resched();
cond_resched();
preempt_disable();


2011-02-02 16:24:06

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH] softirq: Avoid stack switch from ksoftirqd

On Wed, 2011-02-02 at 17:10 +0100, Thomas Gleixner wrote:
> ksoftirqd() calls do_softirq() which switches stacks on several
> architectures. That makes no sense at all. ksoftirqd's stack is
> sufficient.
>
> Call __do_softirq() directly.
>
> Signed-off-by: Thomas Gleixner <[email protected]>

Acked-by: Peter Zijlstra <[email protected]>

> ---
> kernel/softirq.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> Index: linux-2.6-tip/kernel/softirq.c
> ===================================================================
> --- linux-2.6-tip.orig/kernel/softirq.c
> +++ linux-2.6-tip/kernel/softirq.c
> @@ -738,7 +738,10 @@ static int run_ksoftirqd(void * __bind_c
> don't process */
> if (cpu_is_offline((long)__bind_cpu))
> goto wait_to_die;
> - do_softirq();
> + local_irq_disable();
> + if (local_softirq_pending())
> + __do_softirq();
> + local_irq_enable();
> preempt_enable_no_resched();
> cond_resched();
> preempt_disable();


2011-02-02 21:51:04

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] softirq: Avoid stack switch from ksoftirqd

From: Thomas Gleixner <[email protected]>
Date: Wed, 2 Feb 2011 17:10:48 +0100 (CET)

> ksoftirqd() calls do_softirq() which switches stacks on several
> architectures. That makes no sense at all. ksoftirqd's stack is
> sufficient.
>
> Call __do_softirq() directly.
>
> Signed-off-by: Thomas Gleixner <[email protected]>

Acked-by: David S. Miller <[email protected]>

2011-02-02 23:32:52

by Frank Rowand

[permalink] [raw]
Subject: Re: [PATCH] softirq: Avoid stack switch from ksoftirqd

On 02/02/11 08:10, Thomas Gleixner wrote:
> ksoftirqd() calls do_softirq() which switches stacks on several
> architectures. That makes no sense at all. ksoftirqd's stack is
> sufficient.
>
> Call __do_softirq() directly.
>
> Signed-off-by: Thomas Gleixner <[email protected]>

Reviewed-by: Frank Rowand <[email protected]>

> ---
> kernel/softirq.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> Index: linux-2.6-tip/kernel/softirq.c
> ===================================================================
> --- linux-2.6-tip.orig/kernel/softirq.c
> +++ linux-2.6-tip/kernel/softirq.c
> @@ -738,7 +738,10 @@ static int run_ksoftirqd(void * __bind_c
> don't process */
> if (cpu_is_offline((long)__bind_cpu))
> goto wait_to_die;
> - do_softirq();
> + local_irq_disable();
> + if (local_softirq_pending())
> + __do_softirq();
> + local_irq_enable();
> preempt_enable_no_resched();
> cond_resched();
> preempt_disable();
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

2011-02-08 18:40:25

by Thomas Gleixner

[permalink] [raw]
Subject: [tip:irq/core] softirq: Avoid stack switch from ksoftirqd

Commit-ID: c305d524e5dd3c3c7a6035083e30950bea1b52dc
Gitweb: http://git.kernel.org/tip/c305d524e5dd3c3c7a6035083e30950bea1b52dc
Author: Thomas Gleixner <[email protected]>
AuthorDate: Wed, 2 Feb 2011 17:10:48 +0100
Committer: Thomas Gleixner <[email protected]>
CommitDate: Tue, 8 Feb 2011 19:37:12 +0100

softirq: Avoid stack switch from ksoftirqd

ksoftirqd() calls do_softirq() which switches stacks on several
architectures. That makes no sense at all. ksoftirqd's stack is
sufficient.

Call __do_softirq() directly.

Signed-off-by: Thomas Gleixner <[email protected]>
Acked-by: Peter Zijlstra <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Heiko Carstens <[email protected]>
Acked-by: David Miller <[email protected]>
Cc: Paul Mundt <[email protected]>
Reviewed-by: Frank Rowand <[email protected]>
LKML-Reference: <[email protected]>
---
kernel/softirq.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/kernel/softirq.c b/kernel/softirq.c
index 68eb5ef..c049046 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -738,7 +738,10 @@ static int run_ksoftirqd(void * __bind_cpu)
don't process */
if (cpu_is_offline((long)__bind_cpu))
goto wait_to_die;
- do_softirq();
+ local_irq_disable();
+ if (local_softirq_pending())
+ __do_softirq();
+ local_irq_enable();
preempt_enable_no_resched();
cond_resched();
preempt_disable();