From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752433AbdATOeb (ORCPT ); Fri, 20 Jan 2017 09:34:31 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:36008 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752033AbdATOea (ORCPT ); Fri, 20 Jan 2017 09:34:30 -0500 Message-ID: <1484922862.16328.117.camel@edumazet-glaptop3.roam.corp.google.com> Subject: [PATCH] percpu_counter: percpu_counter_hotcpu_callback() cleanup From: Eric Dumazet To: Andrew Morton Cc: linux-kernel , Tejun Heo Date: Fri, 20 Jan 2017 06:34:22 -0800 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Dumazet 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 Cc: Tejun Heo --- 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