From patchwork Tue Apr 22 04:05:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 28758 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C478820341 for ; Tue, 22 Apr 2014 04:06:04 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id w8sf19519783qac.0 for ; Mon, 21 Apr 2014 21:06:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type:content-transfer-encoding; bh=moQVdK49d/3dZH6TDsKg9bRpzWgkcrHhwyhqXeA4UgE=; b=dCzo5j9PiZdTGRuutUPrS62jLKHi1GJlAIhkQsorYXCuqdfaHgpO5yc5dyogrGTqRz Dxb+rOET2rGGY9M/ASQ8x+0Vj/pzIJaDXBrHwYYLDNrhPVk0vidaDX+iQLq8MkGXWdx8 N7wTfPnxD4Pbh9wzel30psvn+DsJ0WSPBOAz0WTHhBGs9AANeFaDM5oFAPHX1ZuuOo1S sl28V0cHyAOIhTrhPlEDaRv7dR3HstSEDkQE5SW38WjRluiV+CIxybncnY+u0RoMDSMv ts7xJmXSdW6eAg1WOKZzrOqxbdsaCiT5TFDYE6+yQvobg/6BwOC7V9LdRagOTjX8TPaC Lp4g== X-Gm-Message-State: ALoCoQkMb1VJZ5pq+79tVbVPYrUNGXbz8GeDKAPCwwIpJoioz80lXbv6/l0VfcWTn6/VsSik0VRk X-Received: by 10.236.32.236 with SMTP id o72mr17612464yha.42.1398139564207; Mon, 21 Apr 2014 21:06:04 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.213 with SMTP id u79ls921484qge.79.gmail; Mon, 21 Apr 2014 21:06:04 -0700 (PDT) X-Received: by 10.220.167.2 with SMTP id o2mr34639906vcy.8.1398139564099; Mon, 21 Apr 2014 21:06:04 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id ph6si6666426veb.53.2014.04.21.21.06.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Apr 2014 21:06:04 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id lf12so1963556vcb.11 for ; Mon, 21 Apr 2014 21:06:04 -0700 (PDT) X-Received: by 10.220.250.203 with SMTP id mp11mr34588335vcb.2.1398139563978; Mon, 21 Apr 2014 21:06:03 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp339625vcb; Mon, 21 Apr 2014 21:06:03 -0700 (PDT) X-Received: by 10.66.148.230 with SMTP id tv6mr684503pab.155.1398139562879; Mon, 21 Apr 2014 21:06:02 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id hb10si18101428pbc.140.2014.04.21.21.06.02; Mon, 21 Apr 2014 21:06:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751662AbaDVEFu (ORCPT + 26 others); Tue, 22 Apr 2014 00:05:50 -0400 Received: from mail-wg0-f49.google.com ([74.125.82.49]:37451 "EHLO mail-wg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750723AbaDVEFs (ORCPT ); Tue, 22 Apr 2014 00:05:48 -0400 Received: by mail-wg0-f49.google.com with SMTP id a1so3438153wgh.32 for ; Mon, 21 Apr 2014 21:05:47 -0700 (PDT) X-Received: by 10.194.185.148 with SMTP id fc20mr31652829wjc.27.1398139547113; Mon, 21 Apr 2014 21:05:47 -0700 (PDT) Received: from [127.0.0.1] ([213.122.173.131]) by mx.google.com with ESMTPSA id wl6sm59962593wjb.3.2014.04.21.21.05.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 21 Apr 2014 21:05:46 -0700 (PDT) Message-ID: <5355EA95.1060603@linaro.org> Date: Tue, 22 Apr 2014 09:35:41 +0530 From: viresh kumar User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Frederic Weisbecker CC: tglx@linutronix.de, linaro-kernel@lists.linaro.org, linaro-networking@linaro.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2 14/19] tick-sched: add comment about 'idle_active' in tick_nohz_idle_exit() References: <387f4713d52595f055620f39dc7a0edad7d4d8bf.1398072824.git.viresh.kumar@linaro.org> <20140421232047.GA5579@localhost.localdomain> In-Reply-To: <20140421232047.GA5579@localhost.localdomain> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On Tuesday 22 April 2014 04:50 AM, Frederic Weisbecker wrote: > It's still over-detailed. Much of the above is easily deduced after common review. OTOH > I proposed to summarize there: https://lkml.org/lkml/2014/4/11/334 > The below disambiguates it a bit further. Hmm.. Something broke for sure in my repo. I do remember updating this patch with your comments and something went wrong while playing with patches. Sorry for that. Fixed my repo now. > Now it's eventually getting as big as your comment ;-) > > > /* > * ts->idle_active drives the idle time which typically elapses in the idle loop > * but breaks on IRQs interrupting idle loop. > * > * Hence ts->idle_active can be 1 here if we exit the idle loop without the help of > * an IRQ. OTOH it can be 0 on idle exit if a wake up IPI pulled the CPU out of > * the idle loop. Since we know that we'll be exiting the idle task after the wake > * up IPI, all the pending idle sleep time is flushed on irq entry and no more is > * accounted further thanks to the need_resched() check on irq_exit(). > */ @Thomas: Please consider this patch instead: Author: Viresh Kumar Date: Mon Apr 21 15:25:10 2014 +0530 tick-sched: add comment about 'idle_active' in tick_nohz_idle_exit() The sequence of calls for dynticks CPUs is a bit confusing. Add a comment in tick_nohz_idle_exit() to mention it clearly. All information required is in commit and this conversation with Frederic. https://lkml.org/lkml/2014/4/10/355 Suggested-by: Frederic Weisbecker Signed-off-by: Viresh Kumar --- kernel/time/tick-sched.c | 11 +++++++++++ 1 file changed, 11 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 71f64ee..b2f024f 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -922,6 +922,17 @@ void tick_nohz_idle_exit(void) ts->inidle = 0; + /* + * ts->idle_active drives the idle time which typically elapses in the + * idle loop but breaks on IRQs interrupting idle loop. + * + * Hence ts->idle_active can be 1 here if we exit the idle loop without + * the help of an IRQ. OTOH it can be 0 on idle exit if a wake up IPI + * pulled the CPU out of the idle loop. Since we know that we'll be + * exiting the idle task after the wake up IPI, all the pending idle + * sleep time is flushed on irq entry and no more is accounted further + * thanks to the need_resched() check on irq_exit(). + */ if (ts->idle_active || ts->tick_stopped) now = ktime_get();