From patchwork Mon Jun 22 08:02:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 50138 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3932021594 for ; Mon, 22 Jun 2015 08:03:40 +0000 (UTC) Received: by lagh6 with SMTP id h6sf43118131lag.0 for ; Mon, 22 Jun 2015 01:03:39 -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=DCPERmR8/U1zd0axdT0Tu40Pbu0zJX5KO8nK4BmDYCc=; b=kJeScLz+vpXyylYXmBKVMUuSVCpMYl/vjRBTIFLOF67AafaunZx5s+GOdLi/BZuyc1 Dp+e0o9ZyFYa1IKAC9of+y4N25DW94r7XWPAqTP9SB75TagGLICVFb6XBgwT2k2DOjmG 1fz/hud/fDABXXnHCRK4hNYmHgokAjeeGKGpiHl1H2e7zG/LIM8HCSBj+b65yW94YxXN QoVG0mZhspmpwTyIxXxqFG51T08tio5SxKt3Vi1UH3mgk7ALjCpUMwuWOTxu+VKTASol gcFjf6tsI4ufZtdGB4pAJYvBar/IBlJsBKqhPsS1j8R72Uk522p0nAZ2xB65PSWShqzJ Bvng== X-Gm-Message-State: ALoCoQnAYOHMFYl/DDpn7qYTg65RQ3TKxvre/8cCGNm53bzdW7v6E7crKtEb/vgoZSS/PsMWa7jF X-Received: by 10.180.182.49 with SMTP id eb17mr15056563wic.2.1434960218977; Mon, 22 Jun 2015 01:03:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.23.129 with SMTP id m1ls782104laf.76.gmail; Mon, 22 Jun 2015 01:03:38 -0700 (PDT) X-Received: by 10.152.181.34 with SMTP id dt2mr28744805lac.84.1434960218762; Mon, 22 Jun 2015 01:03:38 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id wm3si15876094lac.177.2015.06.22.01.03.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jun 2015 01:03:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by lagx9 with SMTP id x9so16772477lag.1 for ; Mon, 22 Jun 2015 01:03:38 -0700 (PDT) X-Received: by 10.152.6.69 with SMTP id y5mr28514421lay.72.1434960218340; Mon, 22 Jun 2015 01:03:38 -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.112.108.230 with SMTP id hn6csp2208852lbb; Mon, 22 Jun 2015 01:03:37 -0700 (PDT) X-Received: by 10.70.94.167 with SMTP id dd7mr57528183pdb.115.1434960216613; Mon, 22 Jun 2015 01:03:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n11si28457864pdl.134.2015.06.22.01.03.35; Mon, 22 Jun 2015 01:03:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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 S1755993AbbFVIDc (ORCPT + 11 others); Mon, 22 Jun 2015 04:03:32 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:33317 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756129AbbFVID3 (ORCPT ); Mon, 22 Jun 2015 04:03:29 -0400 Received: by padev16 with SMTP id ev16so129131523pad.0 for ; Mon, 22 Jun 2015 01:03:28 -0700 (PDT) X-Received: by 10.66.129.140 with SMTP id nw12mr57286453pab.68.1434960208799; Mon, 22 Jun 2015 01:03:28 -0700 (PDT) Received: from localhost ([122.167.71.211]) by mx.google.com with ESMTPSA id xv9sm18869936pbc.2.2015.06.22.01.03.27 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 22 Jun 2015 01:03:28 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Preeti U Murthy Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar Subject: [PATCH 06/10] cpufreq: ondemand: Drop unnecessary locks from update_sampling_rate() Date: Mon, 22 Jun 2015 13:32:53 +0530 Message-Id: <88c876acc1389b613a7721afdd369d60841f93e9.1434959517.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@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.215.46 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: , 'timer_mutex' is required to sync work-handlers of policy->cpus. update_sampling_rate() is just canceling the works and queuing them again. This isn't protecting anything at all in update_sampling_rate() and is not gonna be of any use. Even if a work-handler is already running for a CPU, cancel_delayed_work_sync() will wait for it to finish. Drop these unnecessary locks. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq_ondemand.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 774bbddae2c9..841e1fa96ee7 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c @@ -267,28 +267,20 @@ static void update_sampling_rate(struct dbs_data *dbs_data, dbs_info = &per_cpu(od_cpu_dbs_info, cpu); cpufreq_cpu_put(policy); - mutex_lock(&dbs_info->cdbs.ccdbs->timer_mutex); - - if (!delayed_work_pending(&dbs_info->cdbs.dwork)) { - mutex_unlock(&dbs_info->cdbs.ccdbs->timer_mutex); + if (!delayed_work_pending(&dbs_info->cdbs.dwork)) continue; - } next_sampling = jiffies + usecs_to_jiffies(new_rate); appointed_at = dbs_info->cdbs.dwork.timer.expires; if (time_before(next_sampling, appointed_at)) { - - mutex_unlock(&dbs_info->cdbs.ccdbs->timer_mutex); cancel_delayed_work_sync(&dbs_info->cdbs.dwork); - mutex_lock(&dbs_info->cdbs.ccdbs->timer_mutex); gov_queue_work(dbs_data, policy, usecs_to_jiffies(new_rate), cpumask_of(cpu)); } - mutex_unlock(&dbs_info->cdbs.ccdbs->timer_mutex); } }