From patchwork Mon Jul 27 12:28:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 51518 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by patches.linaro.org (Postfix) with ESMTPS id 5A34B22918 for ; Mon, 27 Jul 2015 12:29:24 +0000 (UTC) Received: by lbcjj5 with SMTP id jj5sf27130273lbc.1 for ; Mon, 27 Jul 2015 05:29:23 -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=uvLl7wtdj82AFnLRE7DxoFUgzhFnJULvo+5xix/Zwj0=; b=FotnJmP0yaNQKDRzKFzDzV3oIw6XPjbugr3O4cVvN0+Z1l12ub/NpTu1e/eny3zhOi TxSer/aB1eL4vY40tFS7cEwtfEMS6IJ4fmGOCLTqDt/JdUCTj0kxDGuN+rJjKfLgI95x u8J/WEVz7TxjGSdZkUFMk61/D8dnq21d4d54354D7H3I8txpeV97j0EsmM9UwjRx33Z1 JebzA0o2SY/GVVaFJnW+tCld0d1rwFlBEDRyDyfHrPUr6NQdv/nV3LWuInuDW/wwZcHq 8ul1xKBGltrs2JwUCVI9Yu6YaUpVWDWSm+j1c8fgQhMpyucddCwg2tNZz7AwQIIPVQm6 kKoQ== X-Gm-Message-State: ALoCoQnn6/MF3awopcXngjNKO75KkOWNOSzrQwdcGCzPcQZl665nzXvQkpCoHhZl7EntD2bNIlSQ X-Received: by 10.112.171.41 with SMTP id ar9mr12082709lbc.24.1438000163258; Mon, 27 Jul 2015 05:29:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.7 with SMTP id v7ls667460laa.107.gmail; Mon, 27 Jul 2015 05:29:23 -0700 (PDT) X-Received: by 10.112.8.108 with SMTP id q12mr26649260lba.113.1438000163088; Mon, 27 Jul 2015 05:29:23 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id lf6si15124836lac.25.2015.07.27.05.29.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Jul 2015 05:29:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lblf12 with SMTP id f12so52266432lbl.2 for ; Mon, 27 Jul 2015 05:29:23 -0700 (PDT) X-Received: by 10.152.4.163 with SMTP id l3mr27179785lal.35.1438000160783; Mon, 27 Jul 2015 05:29:20 -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.7.198 with SMTP id l6csp1502144lba; Mon, 27 Jul 2015 05:29:19 -0700 (PDT) X-Received: by 10.70.103.70 with SMTP id fu6mr69737568pdb.22.1438000158915; Mon, 27 Jul 2015 05:29:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rf7si28141008pdb.85.2015.07.27.05.29.17; Mon, 27 Jul 2015 05:29:18 -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 S1753496AbbG0M2z (ORCPT + 28 others); Mon, 27 Jul 2015 08:28:55 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:36575 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753305AbbG0M2w (ORCPT ); Mon, 27 Jul 2015 08:28:52 -0400 Received: by pachj5 with SMTP id hj5so50967738pac.3 for ; Mon, 27 Jul 2015 05:28:52 -0700 (PDT) X-Received: by 10.66.230.201 with SMTP id ta9mr68323582pac.95.1438000132140; Mon, 27 Jul 2015 05:28:52 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id b10sm29288486pdo.84.2015.07.27.05.28.51 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 27 Jul 2015 05:28:51 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, preeti.lkml@gmail.com, Viresh Kumar , linux-kernel@vger.kernel.org (open list) Subject: [PATCH V2 5/9] cpufreq: ondemand: Drop unnecessary locks from update_sampling_rate() Date: Mon, 27 Jul 2015 17:58:10 +0530 Message-Id: X-Mailer: git-send-email 2.4.0 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.217.179 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. Reviewed-by: Preeti U Murthy 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 2474c9c34022..f1551fc7b4fd 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.shared->timer_mutex); - - if (!delayed_work_pending(&dbs_info->cdbs.dwork)) { - mutex_unlock(&dbs_info->cdbs.shared->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.shared->timer_mutex); cancel_delayed_work_sync(&dbs_info->cdbs.dwork); - mutex_lock(&dbs_info->cdbs.shared->timer_mutex); gov_queue_work(dbs_data, policy, usecs_to_jiffies(new_rate), cpumask_of(cpu)); } - mutex_unlock(&dbs_info->cdbs.shared->timer_mutex); } }