From patchwork Mon Apr 14 16:23:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 28356 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E0F5820534 for ; Mon, 14 Apr 2014 16:35:57 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id lx4sf46720783iec.11 for ; Mon, 14 Apr 2014 09:35:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=r6Y7ZL3j65fXNAglLaa6ypKLP3GpkZqRuHAVk16cI34=; b=WlPrUePe6xz7SAoIhBE6Z/1tX0h1JOS047lYNpuD+gu+Dm9JwebatX9C0YYYHvKz4X AqXmiRi8BYEGadza55lhEmweu6vbT2j5ZPU39IftTRt6dkLdmAwD0GxYXJ02RBdCulj0 lixqyFA6xsZQ4r5EPjTTc0rPeH2t1jxyejHN5iGi+gy1ZaXpsTVLwDCzSMauFQpVpgD7 2xDpALXkuTG0NgylPr/2lNSV2momcHtvMtgfPu5YgO28DPR8Jc5bMzfFIHlUylcHpmTY +I3KQWpFm1I9HJr6W8XZIY3etONTjvoCLE5Q/zWVXRads0X2jGfn0EfnS0hx1afIIGsW tVkA== X-Gm-Message-State: ALoCoQmrvih2lv91pat2I2RE7UN887pi4l2noE06KnaXEgZusfYSuj6aDszK8+m4UxtKZO5PGu4A X-Received: by 10.182.128.232 with SMTP id nr8mr21411891obb.31.1397493357328; Mon, 14 Apr 2014 09:35:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.89.70 with SMTP id u64ls2609797qgd.80.gmail; Mon, 14 Apr 2014 09:35:57 -0700 (PDT) X-Received: by 10.58.150.68 with SMTP id ug4mr112490veb.50.1397493357097; Mon, 14 Apr 2014 09:35:57 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id tm8si2836865vdc.80.2014.04.14.09.35.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Apr 2014 09:35:57 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id oy12so7565221veb.4 for ; Mon, 14 Apr 2014 09:35:57 -0700 (PDT) X-Received: by 10.220.250.203 with SMTP id mp11mr37076605vcb.2.1397493357008; Mon, 14 Apr 2014 09:35:57 -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 ib8csp163529vcb; Mon, 14 Apr 2014 09:35:56 -0700 (PDT) X-Received: by 10.66.66.66 with SMTP id d2mr45086377pat.36.1397493356203; Mon, 14 Apr 2014 09:35:56 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pu9si9155375pbb.190.2014.04.14.09.35.55; Mon, 14 Apr 2014 09:35:55 -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 S1754925AbaDNQfo (ORCPT + 26 others); Mon, 14 Apr 2014 12:35:44 -0400 Received: from mail-pb0-f52.google.com ([209.85.160.52]:48724 "EHLO mail-pb0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755747AbaDNQ1P (ORCPT ); Mon, 14 Apr 2014 12:27:15 -0400 Received: by mail-pb0-f52.google.com with SMTP id rr13so8435580pbb.39 for ; Mon, 14 Apr 2014 09:27:15 -0700 (PDT) X-Received: by 10.66.136.131 with SMTP id qa3mr44924603pab.77.1397492835448; Mon, 14 Apr 2014 09:27:15 -0700 (PDT) Received: from localhost ([122.167.126.16]) by mx.google.com with ESMTPSA id bu1sm8489208pbb.54.2014.04.14.09.27.12 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 14 Apr 2014 09:27:14 -0700 (PDT) From: Viresh Kumar To: tglx@linutronix.de Cc: linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, Arvind.Chauhan@arm.com, linaro-networking@linaro.org, Viresh Kumar Subject: [PATCH 27/38] tick-sched: remove 'regs' parameter of tick_sched_handle() Date: Mon, 14 Apr 2014 21:53:49 +0530 Message-Id: <4e9e4b7fe0a9417777ab1b7543209da5999d7414.1397492345.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: 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.128.173 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: , tick_sched_handle() is called from two places and both pass 'regs' to it almost same way. This patch removes this parameter to tick_sched_handle() and updates tick_sched_handle() to get that by itself. The only point of difference in the way this routine was called from its callers was, don't call it from process context. To make sure the nohz path doesn't suffer from an additional branch instruction, add unlikely to the if() statement. Though I still don't understand when will we run tick_sched_timer() from process context. I couldn't see a single instance of that happening on my test machine for normal boot followed by some userspace operations. Signed-off-by: Viresh Kumar --- kernel/time/tick-sched.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index bff7f97..ee0768b 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -129,8 +129,17 @@ static void tick_sched_do_timer(ktime_t now) tick_do_update_jiffies64(now); } -static void tick_sched_handle(struct tick_sched *ts, struct pt_regs *regs) +static void tick_sched_handle(struct tick_sched *ts) { + struct pt_regs *regs = get_irq_regs(); + + /* + * Do not call, when we are not in irq context and have + * no valid regs pointer + */ + if (unlikely(!regs)) + return; + #ifdef CONFIG_NO_HZ_COMMON /* * When we are idle and the tick is stopped, we have to touch @@ -942,13 +951,12 @@ static int tick_nohz_reprogram(struct tick_sched *ts, ktime_t now) static void tick_nohz_handler(struct clock_event_device *dev) { struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); - struct pt_regs *regs = get_irq_regs(); ktime_t now = ktime_get(); dev->next_event.tv64 = KTIME_MAX; tick_sched_do_timer(now); - tick_sched_handle(ts, regs); + tick_sched_handle(ts); while (tick_nohz_reprogram(ts, now)) { now = ktime_get(); @@ -1065,17 +1073,10 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer) { struct tick_sched *ts = container_of(timer, struct tick_sched, sched_timer); - struct pt_regs *regs = get_irq_regs(); ktime_t now = ktime_get(); tick_sched_do_timer(now); - - /* - * Do not call, when we are not in irq context and have - * no valid regs pointer - */ - if (regs) - tick_sched_handle(ts, regs); + tick_sched_handle(ts); hrtimer_forward(timer, now, tick_period);