linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] percpu_counter: percpu_counter_hotcpu_callback() cleanup
@ 2017-01-20 14:34 Eric Dumazet
  2017-01-20 15:09 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2017-01-20 14:34 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Tejun Heo

From: Eric Dumazet <edumazet@google.com>

In commit ebd8fef304f9 ("percpu_counter: make percpu_counters_lock
irq-safe") we disabled irqs in percpu_counter_hotcpu_callback()

We can grab every counter spinlock without having to disable
irqs again.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Tejun Heo <tj@kernel.org>
---
 lib/percpu_counter.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c
index c8cebb1370765fac92170cd0d2f8ed1ede0a01da..9c21000df0b5ea1b99a83fd73a338073cb7fd016 100644
--- a/lib/percpu_counter.c
+++ b/lib/percpu_counter.c
@@ -176,13 +176,12 @@ static int percpu_counter_cpu_dead(unsigned int cpu)
 	spin_lock_irq(&percpu_counters_lock);
 	list_for_each_entry(fbc, &percpu_counters, list) {
 		s32 *pcount;
-		unsigned long flags;
 
-		raw_spin_lock_irqsave(&fbc->lock, flags);
+		raw_spin_lock(&fbc->lock);
 		pcount = per_cpu_ptr(fbc->counters, cpu);
 		fbc->count += *pcount;
 		*pcount = 0;
-		raw_spin_unlock_irqrestore(&fbc->lock, flags);
+		raw_spin_unlock(&fbc->lock);
 	}
 	spin_unlock_irq(&percpu_counters_lock);
 #endif

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

* Re: [PATCH] percpu_counter: percpu_counter_hotcpu_callback() cleanup
  2017-01-20 14:34 [PATCH] percpu_counter: percpu_counter_hotcpu_callback() cleanup Eric Dumazet
@ 2017-01-20 15:09 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2017-01-20 15:09 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Andrew Morton, linux-kernel

On Fri, Jan 20, 2017 at 06:34:22AM -0800, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> In commit ebd8fef304f9 ("percpu_counter: make percpu_counters_lock
> irq-safe") we disabled irqs in percpu_counter_hotcpu_callback()
> 
> We can grab every counter spinlock without having to disable
> irqs again.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Tejun Heo <tj@kernel.org>

Applied to percpu/for-4.11.

Thanks.

-- 
tejun

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

end of thread, other threads:[~2017-01-20 15:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-20 14:34 [PATCH] percpu_counter: percpu_counter_hotcpu_callback() cleanup Eric Dumazet
2017-01-20 15:09 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).