From patchwork Wed Jul 9 06:55:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 33264 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BE935203F4 for ; Wed, 9 Jul 2014 06:56:55 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id rd3sf48474508pab.3 for ; Tue, 08 Jul 2014 23:56:55 -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=6gXPDj93wDoBqxdu1WuxuhXvX33bd6HvgjnVLOiFZFE=; b=ewCaCZF1Rv+tez7v10bn55jGHDgqz2fD2pgrAAgBDolCbY1IPSztSwnQGE3nLgm56t u/kJBfOuo86tIndFYDHRMWd/EVupMknBKGbNSF88v0pXWDoQyoSUZGAswhGHT7LYYq2i NxKjdxtnEAycmbBPlAdB+KWbDNG7+OTPFatn7Upkc3AsoDT75bTXf6pNyQ+JZmjF/2QB k1R3RcfjyVuF1ABKp7H66sqbUxVBqXdHZw1OETzV5tty6MuAg7sSNuKx7YkfXz+8C3a5 h117CX+xUtzly8sCtHIJFYEabnhrUqThArcvsw8/4xvK8L9SaPdZiRQWK+MrVZ51B9yt CJAw== X-Gm-Message-State: ALoCoQnSirmqjp47pzYjY+TKuSvL3AYjSfR+/fXCBaUXCBWlsiUe84nL78uiFD0g9S9shzKSQsTn X-Received: by 10.70.135.129 with SMTP id ps1mr4994041pdb.8.1404889015089; Tue, 08 Jul 2014 23:56:55 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.85.213 with SMTP id n79ls999223qgd.29.gmail; Tue, 08 Jul 2014 23:56:55 -0700 (PDT) X-Received: by 10.52.118.99 with SMTP id kl3mr31845838vdb.18.1404889014600; Tue, 08 Jul 2014 23:56:54 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id k8si16020430vdv.58.2014.07.08.23.56.54 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Jul 2014 23:56:54 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.174 as permitted sender) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id sa20so453220veb.33 for ; Tue, 08 Jul 2014 23:56:54 -0700 (PDT) X-Received: by 10.220.190.197 with SMTP id dj5mr37731765vcb.19.1404889014478; Tue, 08 Jul 2014 23:56:54 -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.221.37.5 with SMTP id tc5csp20669vcb; Tue, 8 Jul 2014 23:56:54 -0700 (PDT) X-Received: by 10.68.102.34 with SMTP id fl2mr3683576pbb.2.1404889013694; Tue, 08 Jul 2014 23:56:53 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ot3si1198493pdb.480.2014.07.08.23.56.53; Tue, 08 Jul 2014 23:56:53 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754882AbaGIG4f (ORCPT + 28 others); Wed, 9 Jul 2014 02:56:35 -0400 Received: from mail-qa0-f42.google.com ([209.85.216.42]:46623 "EHLO mail-qa0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751542AbaGIG4c (ORCPT ); Wed, 9 Jul 2014 02:56:32 -0400 Received: by mail-qa0-f42.google.com with SMTP id dc16so5769026qab.15 for ; Tue, 08 Jul 2014 23:56:31 -0700 (PDT) X-Received: by 10.140.18.243 with SMTP id 106mr63029541qgf.105.1404888991634; Tue, 08 Jul 2014 23:56:31 -0700 (PDT) Received: from localhost (ec2-23-23-178-99.compute-1.amazonaws.com. [23.23.178.99]) by mx.google.com with ESMTPSA id z14sm84944441qaw.7.2014.07.08.23.56.27 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 08 Jul 2014 23:56:31 -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, preeti@linux.vnet.ibm.com, khilman@linaro.org, Viresh Kumar , Ingo Molnar , Peter Zijlstra Subject: [RFC 6/7] rtmutex: don't check for active hrtimer after adding it Date: Wed, 9 Jul 2014 12:25:38 +0530 Message-Id: X-Mailer: git-send-email 2.0.0.rc2 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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.174 as permitted sender) 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: , hrtimer_start*() family never fails to enqueue a hrtimer to a clock-base. The only special case is when the hrtimer was in past. If it is getting enqueued to local CPUs's clock-base, we raise a softirq and exit, else we handle that on next interrupt on remote CPU. At several places in the kernel, we try to make sure if hrtimer was added properly or not by calling hrtimer_active(), like: hrtimer_start(timer, expires, mode); if (hrtimer_active(timer)) { /* Added successfully */ } else { /* Was added in the past */ } As hrtimer_start*() never fails, hrtimer_active() is guaranteed to return '1'. So, there is no point calling hrtimer_active(). This patch updates rtmutex core to get this fixed. Cc: Ingo Molnar Cc: Peter Zijlstra Signed-off-by: Viresh Kumar --- kernel/locking/rtmutex.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c index fc60594..9ea8830 100644 --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c @@ -922,11 +922,8 @@ rt_mutex_slowlock(struct rt_mutex *lock, int state, set_current_state(state); /* Setup the timer, when timeout != NULL */ - if (unlikely(timeout)) { + if (unlikely(timeout)) hrtimer_start_expires(&timeout->timer, HRTIMER_MODE_ABS); - if (!hrtimer_active(&timeout->timer)) - timeout->task = NULL; - } ret = task_blocks_on_rt_mutex(lock, &waiter, current, detect_deadlock);