All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] softirq: a single rcu_bh_qs() call is enough
@ 2014-04-16 16:06 Eric Dumazet
  2014-04-16 22:51 ` Paul E. McKenney
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2014-04-16 16:06 UTC (permalink / raw)
  To: Paul E. McKenney, David Miller; +Cc: netdev, linux-kernel

From: Eric Dumazet <edumazet@google.com>

Calling rcu_bh_qs() after every softirq action is not really needed.

What RCU needs is at least one rcu_bh_qs() per softirq round to note a
quiescent state was passed for rcu_bh

Note for Paul and myself : this could be inlined as a single instruction
and avoid smp_processor_id()
(sone this_cpu_write(rcu_bh_data.passed_quiesce, 1))

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 kernel/softirq.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/softirq.c b/kernel/softirq.c
index b50990a5bea0..b9b2d4906848 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -232,7 +232,6 @@ asmlinkage void __do_softirq(void)
 	bool in_hardirq;
 	__u32 pending;
 	int softirq_bit;
-	int cpu;
 
 	/*
 	 * Mask out PF_MEMALLOC s current task context is borrowed for the
@@ -247,7 +246,6 @@ asmlinkage void __do_softirq(void)
 	__local_bh_disable_ip(_RET_IP_, SOFTIRQ_OFFSET);
 	in_hardirq = lockdep_softirq_start();
 
-	cpu = smp_processor_id();
 restart:
 	/* Reset the pending bitmask before enabling irqs */
 	set_softirq_pending(0);
@@ -276,11 +274,11 @@ restart:
 			       prev_count, preempt_count());
 			preempt_count_set(prev_count);
 		}
-		rcu_bh_qs(cpu);
 		h++;
 		pending >>= softirq_bit;
 	}
 
+	rcu_bh_qs(smp_processor_id());
 	local_irq_disable();
 
 	pending = local_softirq_pending();



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] softirq: a single rcu_bh_qs() call is enough
  2014-04-16 16:06 [PATCH] softirq: a single rcu_bh_qs() call is enough Eric Dumazet
@ 2014-04-16 22:51 ` Paul E. McKenney
  0 siblings, 0 replies; 2+ messages in thread
From: Paul E. McKenney @ 2014-04-16 22:51 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev, linux-kernel

On Wed, Apr 16, 2014 at 09:06:24AM -0700, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> Calling rcu_bh_qs() after every softirq action is not really needed.
> 
> What RCU needs is at least one rcu_bh_qs() per softirq round to note a
> quiescent state was passed for rcu_bh
> 
> Note for Paul and myself : this could be inlined as a single instruction
> and avoid smp_processor_id()
> (sone this_cpu_write(rcu_bh_data.passed_quiesce, 1))
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Looks plausible -- will give it a go!  If nothing breaks, queued for
3.16.

							Thanx, Paul

> ---
>  kernel/softirq.c |    4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/kernel/softirq.c b/kernel/softirq.c
> index b50990a5bea0..b9b2d4906848 100644
> --- a/kernel/softirq.c
> +++ b/kernel/softirq.c
> @@ -232,7 +232,6 @@ asmlinkage void __do_softirq(void)
>  	bool in_hardirq;
>  	__u32 pending;
>  	int softirq_bit;
> -	int cpu;
> 
>  	/*
>  	 * Mask out PF_MEMALLOC s current task context is borrowed for the
> @@ -247,7 +246,6 @@ asmlinkage void __do_softirq(void)
>  	__local_bh_disable_ip(_RET_IP_, SOFTIRQ_OFFSET);
>  	in_hardirq = lockdep_softirq_start();
> 
> -	cpu = smp_processor_id();
>  restart:
>  	/* Reset the pending bitmask before enabling irqs */
>  	set_softirq_pending(0);
> @@ -276,11 +274,11 @@ restart:
>  			       prev_count, preempt_count());
>  			preempt_count_set(prev_count);
>  		}
> -		rcu_bh_qs(cpu);
>  		h++;
>  		pending >>= softirq_bit;
>  	}
> 
> +	rcu_bh_qs(smp_processor_id());
>  	local_irq_disable();
> 
>  	pending = local_softirq_pending();
> 
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-16 22:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-16 16:06 [PATCH] softirq: a single rcu_bh_qs() call is enough Eric Dumazet
2014-04-16 22:51 ` Paul E. McKenney

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.