From patchwork Fri Jun 22 15:17:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. McKenney" X-Patchwork-Id: 9561 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 038D323E55 for ; Fri, 22 Jun 2012 15:27:20 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id B1E8BA180F9 for ; Fri, 22 Jun 2012 15:27:19 +0000 (UTC) Received: by ghbz12 with SMTP id z12so1747929ghb.11 for ; Fri, 22 Jun 2012 08:27:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-content-scanned:x-cbid:x-gm-message-state; bh=ihln48Pc4+vk2rKYe07Tl8eLcyJXvHdRJsslmdJmS20=; b=IxhiAdoxXAbaTnYwDiIOBQ9RoYiOS4iEk2iKRSL0OHZu+MLtXqedxS/6Q0X04XxQvY oEMlVP9/QSweKqH+o7LY0D59JanBcXtei52mSYtDWArEHPwV8ef7AgxEcOMJCHEAwVOJ W7qQ20pjgVU3STGrPYjsLVJEG2v5diTcb/uAm0KRlxa84opdcXPQWLQzNWSCyIXSn6hJ yK2YC/2nFG+uC7ENBqlcZkCS3SBZEEcK1aYbuWsnh3MQIREvGP0vdPOZpBC0T+lMP7SF +g9Cu89RwM1CnjAASTB4xXYf9sE/0Br5dmAbjDrjgYVSIhFT+DsVGB0LXMFk61ZywVhB kCzA== Received: by 10.50.163.99 with SMTP id yh3mr2000834igb.53.1340378838924; Fri, 22 Jun 2012 08:27:18 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp71915ibb; Fri, 22 Jun 2012 08:27:18 -0700 (PDT) Received: by 10.50.183.230 with SMTP id ep6mr1999718igc.52.1340378838479; Fri, 22 Jun 2012 08:27:18 -0700 (PDT) Received: from e37.co.us.ibm.com (e37.co.us.ibm.com. [32.97.110.158]) by mx.google.com with ESMTPS id gg10si9989400pbc.294.2012.06.22.08.27.18 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 22 Jun 2012 08:27:18 -0700 (PDT) Received-SPF: pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.158 as permitted sender) client-ip=32.97.110.158; Authentication-Results: mx.google.com; spf=pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.158 as permitted sender) smtp.mail=paulmck@linux.vnet.ibm.com Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 22 Jun 2012 09:27:15 -0600 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 22 Jun 2012 09:27:14 -0600 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 84574C4000E for ; Fri, 22 Jun 2012 15:25:40 +0000 (WET) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5MFP1n5180126 for ; Fri, 22 Jun 2012 09:25:17 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q5MFOZYn019576 for ; Fri, 22 Jun 2012 09:24:42 -0600 Received: from paulmck-ThinkPad-W500 ([9.47.24.152]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q5MFOZbl019509; Fri, 22 Jun 2012 09:24:35 -0600 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id 1B0C9E71BA; Fri, 22 Jun 2012 08:17:24 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: mingo@elte.hu, laijs@cn.fujitsu.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca, josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, Valdis.Kletnieks@vt.edu, dhowells@redhat.com, eric.dumazet@gmail.com, darren@dvhart.com, fweisbec@gmail.com, sbw@mit.edu, patches@linaro.org, "Paul E. McKenney" Subject: [PATCH tip/core/rcu 19/22] rcu: Allow RCU grace-period initialization to be preempted Date: Fri, 22 Jun 2012 08:17:18 -0700 Message-Id: <1340378241-6458-19-git-send-email-paulmck@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.8 In-Reply-To: <1340378241-6458-1-git-send-email-paulmck@linux.vnet.ibm.com> References: <20120622151655.GA6249@linux.vnet.ibm.com> <1340378241-6458-1-git-send-email-paulmck@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12062215-7408-0000-0000-0000061D4CD7 X-Gm-Message-State: ALoCoQnNL2vqGjm/KvOKJm2hSnUDRvKqt1yYWQbUJYruCMeymUutzortkRu1KvZ4bi4h7oZ5zG7O From: "Paul E. McKenney" RCU grace-period initialization is currently carried out with interrupts disabled, which can result in 200-microsecond latency spikes on systems on which RCU has been configured for 4096 CPUs. This patch therefore makes the RCU grace-period initialization be preemptible, which should eliminate those latency spikes. Similar spikes from grace-period cleanup and the forcing of quiescent states will be dealt with similarly by later patches. Reported-by: Mike Galbraith Reported-by: Dimitri Sivanich Signed-off-by: Paul E. McKenney --- kernel/rcutree.c | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/kernel/rcutree.c b/kernel/rcutree.c index faf4860..e5b4532 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c @@ -1059,6 +1059,7 @@ static int rcu_gp_kthread(void *arg) * don't start another one. */ raw_spin_unlock_irqrestore(&rnp->lock, flags); + cond_resched(); continue; } @@ -1069,6 +1070,7 @@ static int rcu_gp_kthread(void *arg) */ rsp->fqs_need_gp = 1; raw_spin_unlock_irqrestore(&rnp->lock, flags); + cond_resched(); continue; } @@ -1079,10 +1081,10 @@ static int rcu_gp_kthread(void *arg) rsp->fqs_state = RCU_GP_INIT; /* Stop force_quiescent_state. */ rsp->jiffies_force_qs = jiffies + RCU_JIFFIES_TILL_FORCE_QS; record_gp_stall_check_time(rsp); - raw_spin_unlock(&rnp->lock); /* leave irqs disabled. */ + raw_spin_unlock_irqrestore(&rnp->lock, flags); /* Exclude any concurrent CPU-hotplug operations. */ - raw_spin_lock(&rsp->onofflock); /* irqs already disabled. */ + get_online_cpus(); /* * Set the quiescent-state-needed bits in all the rcu_node @@ -1102,7 +1104,7 @@ static int rcu_gp_kthread(void *arg) * due to the fact that we have irqs disabled. */ rcu_for_each_node_breadth_first(rsp, rnp) { - raw_spin_lock(&rnp->lock); /* irqs already disabled. */ + raw_spin_lock_irqsave(&rnp->lock, flags); rcu_preempt_check_blocked_tasks(rnp); rnp->qsmask = rnp->qsmaskinit; rnp->gpnum = rsp->gpnum; @@ -1113,15 +1115,16 @@ static int rcu_gp_kthread(void *arg) trace_rcu_grace_period_init(rsp->name, rnp->gpnum, rnp->level, rnp->grplo, rnp->grphi, rnp->qsmask); - raw_spin_unlock(&rnp->lock); /* irqs remain disabled. */ + raw_spin_unlock_irqrestore(&rnp->lock, flags); + cond_resched(); } rnp = rcu_get_root(rsp); - raw_spin_lock(&rnp->lock); /* irqs already disabled. */ + raw_spin_lock_irqsave(&rnp->lock, flags); /* force_quiescent_state() now OK. */ rsp->fqs_state = RCU_SIGNAL_INIT; - raw_spin_unlock(&rnp->lock); /* irqs remain disabled. */ - raw_spin_unlock_irqrestore(&rsp->onofflock, flags); + raw_spin_unlock_irqrestore(&rnp->lock, flags); + put_online_cpus(); } return 0; }