From patchwork Tue Oct 13 08:09:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 54824 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by patches.linaro.org (Postfix) with ESMTPS id 5F37223001 for ; Tue, 13 Oct 2015 08:09:32 +0000 (UTC) Received: by lbbpc3 with SMTP id pc3sf5024129lbb.2 for ; Tue, 13 Oct 2015 01:09:31 -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=g3ChGh4gSwH8mxaZAvdR6mMwLbX/6mUOO5vQD+xZQrs=; b=VYTOMuUmN9GKzD8JKPgmjItxhsbYd54CnY//ztaRFPkw7FX2e17w8pza9NvqDSXKdr +aaWW501ykf6yJM60zF8yomz4k1Otk4/ko4HX7nAhWnfEmRKpazp6E2015NRj6+BgFwv 7kHWfp4lxboy8eOR3BJH+83RrDP06Ja+pSmQaAX6FVo1JIMCMPsTJwJuOPQq0CpfMxzs poIw0KlAzA+Gq1noAAYHGfWdTFXRDpuTVY4R4y7yR65V4Pfa27Zryy7EfUWydq1h/dMX gnvk0WiWIWq16hZn8hSTtdkMLka2pwV9C78zNbnnoRjJBvSl3P63US43ZxnkDOvoVxaP cssA== X-Gm-Message-State: ALoCoQmMQc5CzHBgsh1PubiN1Y3My3m9KhewRH5l0KVJgdHZscklfzT3HS5rWu3K5hUNCUHPnHYM X-Received: by 10.112.63.165 with SMTP id h5mr6726556lbs.18.1444723771290; Tue, 13 Oct 2015 01:09:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.84.1 with SMTP id i1ls566472lfb.15.gmail; Tue, 13 Oct 2015 01:09:30 -0700 (PDT) X-Received: by 10.112.158.38 with SMTP id wr6mr14612499lbb.25.1444723770846; Tue, 13 Oct 2015 01:09:30 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id jh5si1355001lbc.136.2015.10.13.01.09.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Oct 2015 01:09:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by lbcao8 with SMTP id ao8so10306625lbc.3 for ; Tue, 13 Oct 2015 01:09:30 -0700 (PDT) X-Received: by 10.112.159.136 with SMTP id xc8mr11964120lbb.76.1444723770689; Tue, 13 Oct 2015 01:09:30 -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.59.35 with SMTP id w3csp1974318lbq; Tue, 13 Oct 2015 01:09:29 -0700 (PDT) X-Received: by 10.68.90.34 with SMTP id bt2mr39689389pbb.145.1444723768781; Tue, 13 Oct 2015 01:09:28 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sx6si3350355pbc.55.2015.10.13.01.09.28; Tue, 13 Oct 2015 01:09:28 -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 S1752748AbbJMIJ0 (ORCPT + 30 others); Tue, 13 Oct 2015 04:09:26 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:36443 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752549AbbJMIJX (ORCPT ); Tue, 13 Oct 2015 04:09:23 -0400 Received: by pacex6 with SMTP id ex6so14161947pac.3 for ; Tue, 13 Oct 2015 01:09:22 -0700 (PDT) X-Received: by 10.66.141.42 with SMTP id rl10mr39294706pab.18.1444723762172; Tue, 13 Oct 2015 01:09:22 -0700 (PDT) Received: from localhost ([223.227.239.124]) by smtp.gmail.com with ESMTPSA id nu5sm2225186pbb.65.2015.10.13.01.09.20 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 13 Oct 2015 01:09:21 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar , Preeti U Murthy , linux-kernel@vger.kernel.org (open list) Subject: [PATCH V3 1/5] cpufreq: ondemand: Drop unnecessary locks from update_sampling_rate() Date: Tue, 13 Oct 2015 13:39:01 +0530 Message-Id: <56084623b2c27372a4c2c598151dd47176c3e26f.1444723240.git.viresh.kumar@linaro.org> 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.175 as permitted sender) smtp.mailfrom=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 1fa9088c84a8..03ac6ce54042 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c @@ -267,27 +267,19 @@ 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), true); } - mutex_unlock(&dbs_info->cdbs.shared->timer_mutex); } }