From patchwork Thu Apr 26 17:56:08 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: 8140 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 0DF9223E13 for ; Thu, 26 Apr 2012 17:58:42 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 6C74AA18620 for ; Thu, 26 Apr 2012 17:58:38 +0000 (UTC) Received: by iage36 with SMTP id e36so2685068iag.11 for ; Thu, 26 Apr 2012 10:58:37 -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:date:from :to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent :x-content-scanned:x-cbid:x-gm-message-state; bh=Z76NkgO29y9L95NGRUTdrQKgrHI25OfLhl74YHn5px8=; b=WnHBUKghKHgTfQWiB9Md13fnARYWO9FMT61i0PJudlBQczLSxOOekSi+4GCjDvWxJy VBsmASGF75jRetJNjrStTd5qNtbBdhj0/DcoHB8W3xqUQcwhy1jQMFqqJFW8yWRNwvtq rhrkXXnGjwosvVSCKZeW1OolBBxBgjGQOSirQi8RQQHvoaUnwThNPr6jV27AlNGKlfz9 StYCxLUZHio9edlNPmIDXrMsjN+7vFw0zBru808k36XgjUcLeh6uHbOJggcTS+HLeajA TZhyDNgnrIRUCKutBQYNJaXUoz6h+L7eC7T50+gU9LRU8AM70oMHDYaQmFJHzm8X8Ypj lHaQ== Received: by 10.50.194.163 with SMTP id hx3mr7947252igc.49.1335463117797; Thu, 26 Apr 2012 10:58:37 -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.137.198 with SMTP id x6csp354317ibt; Thu, 26 Apr 2012 10:58:36 -0700 (PDT) Received: by 10.60.20.230 with SMTP id q6mr10370742oee.60.1335463116155; Thu, 26 Apr 2012 10:58:36 -0700 (PDT) Received: from e33.co.us.ibm.com (e33.co.us.ibm.com. [32.97.110.151]) by mx.google.com with ESMTPS id r9si2428803oee.26.2012.04.26.10.58.35 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 Apr 2012 10:58:36 -0700 (PDT) Received-SPF: pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.151 as permitted sender) client-ip=32.97.110.151; Authentication-Results: mx.google.com; spf=pass (google.com: domain of paulmck@linux.vnet.ibm.com designates 32.97.110.151 as permitted sender) smtp.mail=paulmck@linux.vnet.ibm.com Received: from /spool/local by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 26 Apr 2012 11:58:35 -0600 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 26 Apr 2012 11:58:33 -0600 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id DEE2D3E40059; Thu, 26 Apr 2012 11:57:05 -0600 (MDT) 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 q3QHuRHV159822; Thu, 26 Apr 2012 11:56:44 -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 q3QHu9FS007632; Thu, 26 Apr 2012 11:56:12 -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 q3QHu84F007337; Thu, 26 Apr 2012 11:56:08 -0600 Received: by paulmck-ThinkPad-W500 (Postfix, from userid 1000) id 75992E4D77; Thu, 26 Apr 2012 10:56:08 -0700 (PDT) Date: Thu, 26 Apr 2012 10:56:08 -0700 From: "Paul E. McKenney" To: Steven Rostedt Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, 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, Valdis.Kletnieks@vt.edu, dhowells@redhat.com, eric.dumazet@gmail.com, darren@dvhart.com, fweisbec@gmail.com, patches@linaro.org, "Paul E. McKenney" Subject: Re: [PATCH RFC tip/core/rcu 4/4] rcu: Ensure that RCU_FAST_NO_HZ timers expire on correct CPU Message-ID: <20120426175608.GG2407@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <20120423161539.GA6467@linux.vnet.ibm.com> <1335197761-6577-1-git-send-email-paulmck@linux.vnet.ibm.com> <1335197761-6577-4-git-send-email-paulmck@linux.vnet.ibm.com> <1335445496.13683.21.camel@twins> <20120426155450.GD2407@linux.vnet.ibm.com> <1335456539.28106.185.camel@gandalf.stny.rr.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1335456539.28106.185.camel@gandalf.stny.rr.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12042617-2398-0000-0000-000006230B2C X-Gm-Message-State: ALoCoQkIcc1OsBGncFkCkPS+02e/mlVWG5Hs9tFY4pp+LQbNL4+0Wm0gKsrBKBvkGR05beM4SHYr On Thu, Apr 26, 2012 at 12:08:59PM -0400, Steven Rostedt wrote: > On Thu, 2012-04-26 at 08:54 -0700, Paul E. McKenney wrote: > > > > The simpler change looks to use mod_timer_pinned() > > > > Good point! > > > > Except... Now that you mention it, I don't see how mod_timer_pinned() > > actually helps. It looks to me like a CPU-hotplug operation will > > migrate the timers anyway. > > > > This is actually (in theory) harmless in the RCU_FAST_NO_HZ case, because > > the CPU_DYING stuff will force a wakeup of the CPU in question, which > > will cancel the timer. But still, mod_timer_pinned() has a rather > > misleading name. ;-) > > > > But a line is a line, so I made this change. > > It's expected that if you use this (or anything else pinned to a CPU) > that you add the hotplug hooks to handle a CPU going down. > > There's only two users of this that I see. One is > arch/x86/kernel/apic/x2apic_uv_x.c, that has the hotplug handling. The > other is drivers/net/ethernet/tile/tilepro.c, that does not have hotplug > handling, but the tile arch does not support hotplug anyway: > > arch/tile/kernel/process.c: cpu_idle() > > if (cpu_is_offline(cpu)) > BUG(); /* no HOTPLUG_CPU */ So what mod_timer_pinned() is really doing is ensuring that the timer is registered on the current CPU instead of being registered on some other CPU due to idleness considerations. As you say, unless you do something in CPU-hotplug notifiers, the timer -will- be migrated at CPU-hotplug time. Given that, wouldn't it make sense for the mod_timer_pinned() block comment to say that? Thanx, Paul ------------------------------------------------------------------------ timer: Fix mod_timer_pinned() header comment The mod_timer_pinned() header comment states that it prevents timers from being migrated to a different CPU. This is not the case, instead, it ensures that the timer is posted to the current CPU, but does nothing to prevent CPU-hotplug operations from migrating the timer. This commit therefore brings the comment header into alignment with reality. Signed-off-by: Paul E. McKenney Signed-off-by: Paul E. McKenney Acked-by: Steven Rostedt diff --git a/kernel/timer.c b/kernel/timer.c index a297ffc..7114336 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -861,7 +861,12 @@ EXPORT_SYMBOL(mod_timer); * * mod_timer_pinned() is a way to update the expire field of an * active timer (if the timer is inactive it will be activated) - * and not allow the timer to be migrated to a different CPU. + * and to ensure that the timer is scheduled on the current CPU. + * Note that this does not prevent the timer from being migrated + * when the current CPU goes offline. If this is a problem for + * you, use CPU-hotplug notifiers to handle it correctly, for + * example, cancelling the timer when the corresponding CPU goes + * offline. * * mod_timer_pinned(timer, expires) is equivalent to: *