From patchwork Wed Apr 16 16:06:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 339627 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 649521400E5 for ; Thu, 17 Apr 2014 02:06:58 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422683AbaDPQGf (ORCPT ); Wed, 16 Apr 2014 12:06:35 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:44398 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422635AbaDPQGc (ORCPT ); Wed, 16 Apr 2014 12:06:32 -0400 Received: by mail-pa0-f53.google.com with SMTP id ld10so11053653pab.12 for ; Wed, 16 Apr 2014 09:06:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:cc:date:content-type :content-transfer-encoding:mime-version; bh=sRx1AeibJMsVPGUAyRRil/T4Ce3kdfrqETIpdi05ByA=; b=PnLHohm6pwD9FMOynaZPdeCAceBlR8FqZGk/1NQfWNffKCgjwT96jaCBtOy1RnRm5b Ru1Vwiee0nK9zSGvlqKapcD7stKNGF71ReLC4wvQqXs/KGi9Go8kMQXV1ORsvwYWWE+6 wuxQEuX5BOCfkf4muRr+Szbe3FH3Yx4pV6DL5IQxjmmJSFRyaYVx7R4V5TzVvJLJxo/H xDgONpZuQ7KnjyKQwZnyQ3q0FQfHUdr0Qdtmd3FzMHDJww4sf6cQ4IA0AdhYn8E12nDP UDfn0yENhCAQsVuRjtkkmXZ/dAd+yWQCV5jV5w2W7NZmMVbyylKv3mlJaYsgTB8cSXd7 D+rA== X-Received: by 10.66.66.66 with SMTP id d2mr9510257pat.36.1397664392114; Wed, 16 Apr 2014 09:06:32 -0700 (PDT) Received: from [172.26.50.78] ([172.26.50.78]) by mx.google.com with ESMTPSA id x5sm47877684pbw.26.2014.04.16.09.06.30 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Wed, 16 Apr 2014 09:06:31 -0700 (PDT) Message-ID: <1397664384.4222.124.camel@edumazet-glaptop2.roam.corp.google.com> Subject: [PATCH] softirq: a single rcu_bh_qs() call is enough From: Eric Dumazet To: "Paul E. McKenney" , David Miller Cc: netdev , "linux-kernel@vger.kernel.org" Date: Wed, 16 Apr 2014 09:06:24 -0700 X-Mailer: Evolution 3.2.3-0ubuntu6 Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eric Dumazet 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 --- kernel/softirq.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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();