From patchwork Tue Oct 30 16:54:32 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: 12606 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 AF9BB23F58 for ; Tue, 30 Oct 2012 17:00:50 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id DB7A8A18FE0 for ; Tue, 30 Oct 2012 17:00:49 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so707250iej.11 for ; Tue, 30 Oct 2012 10:00:49 -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=d3TCJXPJo8whKZAx4a9tZ7rbsLszke86nqdsdhVrmYk=; b=RDRr0tEJKwwC5c4vjOpmTVlPCTbrnll7lHwgqKPzHq2nnhD0mtRiX/QXbfPyYM+Iky gKEXDMhuz0tHwNqJZKP+C6MCK8uB24mFTOdydmrAmxwtykMxoksuLnyaPuDe3MuBBeTk Hlv5AgL1l92tJjej3lae640P3R88I18YcnEKqO69n9hudpUtLLQ7BpL0a8I/b2oxYfew 60j6dAQqi3K8HfTczPrmxZ+ihJTqToyV4lBJh0YUKZ8B8H5EtOTjsKJs6WnrK1qmo7iC QVI/YUxfVguWgFKdapGgyOfx8CV4ED9CwfY2VnaNiMVRYegcCATy1InYpTSfpqhPC9fC 5YBg== Received: by 10.50.161.169 with SMTP id xt9mr2066951igb.62.1351616449284; Tue, 30 Oct 2012 10:00:49 -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.50.67.148 with SMTP id n20csp450991igt; Tue, 30 Oct 2012 10:00:49 -0700 (PDT) Received: by 10.50.41.132 with SMTP id f4mr2111227igl.39.1351616448927; Tue, 30 Oct 2012 10:00:48 -0700 (PDT) Received: from e6.ny.us.ibm.com (e6.ny.us.ibm.com. [32.97.182.146]) by mx.google.com with ESMTPS id ak4si1241361icc.94.2012.10.30.10.00.48 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 30 Oct 2012 10:00:48 -0700 (PDT) Received-SPF: pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.182.146 as permitted sender) client-ip=32.97.182.146; Authentication-Results: mx.google.com; spf=pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.182.146 as permitted sender) smtp.mail=paulmck@linux.vnet.ibm.com Received: from /spool/local by e6.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 30 Oct 2012 13:00:42 -0400 Received: from d01dlp01.pok.ibm.com (9.56.250.166) by e6.ny.us.ibm.com (192.168.1.106) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 30 Oct 2012 12:55:13 -0400 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 977BF38C8071; Tue, 30 Oct 2012 12:54:45 -0400 (EDT) Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q9UGsi31130662; Tue, 30 Oct 2012 12:54:45 -0400 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 q9UGsdnO028343; Tue, 30 Oct 2012 10:54:41 -0600 Received: from paulmck-ThinkPad-W500 (sig-9-65-77-17.mts.ibm.com [9.65.77.17]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q9UGsbpi028153; Tue, 30 Oct 2012 10:54:38 -0600 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id AA551EBED7; Tue, 30 Oct 2012 09:54:37 -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, edumazet@google.com, darren@dvhart.com, fweisbec@gmail.com, sbw@mit.edu, patches@linaro.org, "Paul E. McKenney" , "Paul E. McKenney" Subject: [PATCH tip/core/rcu 3/7] cpu: No more __stop_machine() in _cpu_down() Date: Tue, 30 Oct 2012 09:54:32 -0700 Message-Id: <1351616076-25617-3-git-send-email-paulmck@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.8 In-Reply-To: <1351616076-25617-1-git-send-email-paulmck@linux.vnet.ibm.com> References: <20121030165415.GA25438@linux.vnet.ibm.com> <1351616076-25617-1-git-send-email-paulmck@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12103016-1976-0000-0000-000012DB53D4 X-Gm-Message-State: ALoCoQkHq8Eshn2Y4SamIIIpN14pXkAIVmsP+zWoOXzzNH7YBSAKjDrmdRWN8fVOChBtWQGf6UmX From: "Paul E. McKenney" The _cpu_down() function invoked as part of the CPU-hotplug offlining process currently invokes __stop_machine(), which is slow and inflicts substantial real-time latencies on the entire system. This patch substitutes stop_cpus() for __stop_machine() in order to improve both performance and real-time latency. This is currently unsafe, because there are a number of uses of preempt_disable() that are intended to block CPU-hotplug offlining. These will be fixed, but in the meantime, this commit is one way to help locate them. Signed-off-by: Paul E. McKenney Signed-off-by: Paul E. McKenney --- kernel/cpu.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/cpu.c b/kernel/cpu.c index 42bd331..6b37ce0 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -247,13 +247,18 @@ static int __ref take_cpu_down(void *_param) { struct take_cpu_down_param *param = _param; int err; + unsigned long flags; /* Ensure this CPU doesn't handle any more interrupts. */ + local_irq_save(flags); err = __cpu_disable(); - if (err < 0) + if (err < 0) { + local_irq_restore(flags); return err; + } cpu_notify(CPU_DYING | param->mod, param->hcpu); + local_irq_restore(flags); return 0; } @@ -286,7 +291,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen) } smpboot_park_threads(cpu); - err = __stop_machine(take_cpu_down, &tcd_param, cpumask_of(cpu)); + err = stop_cpus(cpumask_of(cpu), take_cpu_down, &tcd_param); if (err) { /* CPU didn't die: tell everyone. Can't complain. */ smpboot_unpark_threads(cpu);