From patchwork Tue Oct 13 08:09:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 54825 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by patches.linaro.org (Postfix) with ESMTPS id 5BDB823001 for ; Tue, 13 Oct 2015 08:09:39 +0000 (UTC) Received: by wicid10 with SMTP id id10sf6062833wic.2 for ; Tue, 13 Oct 2015 01:09:38 -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=RyRDZpQP07vU41MdsgP2hEVpIQ14EuIT/MDkOxgUFpo=; b=BsRbzZ4rqiG2dpwXvCjAUn+AYzEHele5xhPqLni7fSLTtKjPDijgB01iDy2lYLsnai cY+bG6mdB3LhZrOciUYYRty6Htg6ZRSd/rd5WqEC9RFxbFNIcn4k4tDy4NXndjl6tgnJ EaGDGNQdwlLrcBbYjqoG8PVTE5qb3AF3bDLVRttBqyot1CfCC7JVscLDOZl7GTB3pdnM kxP+wx70RSIIjccq2TNLrcs/68DK9CM0ySrEMvO+puAVA7SG4IGWEWqF6MBZYHhwt9Y2 2bPCm6B18oFdMrGxv3gvmnHUJK6LC1Kn9f+x+k3jT4N2DSvgLejqtVVKhrEm18/XgFqc jMRg== X-Gm-Message-State: ALoCoQmaMZ5fOuWN/70jpFsrtxHN56xkA6D/LLtk0sgiEpH4oJjxUcajVGjRkXiehEhSV0+wQ2bH X-Received: by 10.112.145.3 with SMTP id sq3mr6693764lbb.7.1444723778621; Tue, 13 Oct 2015 01:09:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.153.9 with SMTP id b9ls218892lfe.85.gmail; Tue, 13 Oct 2015 01:09:38 -0700 (PDT) X-Received: by 10.112.55.99 with SMTP id r3mr14218092lbp.64.1444723778298; Tue, 13 Oct 2015 01:09:38 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id a7si1387916lfb.32.2015.10.13.01.09.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Oct 2015 01:09:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbbk10 with SMTP id k10so10391499lbb.0 for ; Tue, 13 Oct 2015 01:09:38 -0700 (PDT) X-Received: by 10.112.17.34 with SMTP id l2mr14138784lbd.117.1444723778066; Tue, 13 Oct 2015 01:09: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.59.35 with SMTP id w3csp1974374lbq; Tue, 13 Oct 2015 01:09:37 -0700 (PDT) X-Received: by 10.107.169.167 with SMTP id f39mr10472261ioj.104.1444723777103; Tue, 13 Oct 2015 01:09:37 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e9si1862561igi.58.2015.10.13.01.09.36; Tue, 13 Oct 2015 01:09:37 -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 S1752803AbbJMIJd (ORCPT + 30 others); Tue, 13 Oct 2015 04:09:33 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:36591 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752749AbbJMIJ3 (ORCPT ); Tue, 13 Oct 2015 04:09:29 -0400 Received: by pacex6 with SMTP id ex6so14165164pac.3 for ; Tue, 13 Oct 2015 01:09:29 -0700 (PDT) X-Received: by 10.66.100.166 with SMTP id ez6mr38791800pab.78.1444723769394; Tue, 13 Oct 2015 01:09:29 -0700 (PDT) Received: from localhost ([223.227.239.124]) by smtp.gmail.com with ESMTPSA id oo2sm2215564pbb.86.2015.10.13.01.09.27 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 13 Oct 2015 01:09:28 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar , linux-kernel@vger.kernel.org (open list) Subject: [PATCH V3 2/5] cpufreq: ondemand: update sampling rate immediately Date: Tue, 13 Oct 2015 13:39:02 +0530 Message-Id: <1746c301a8f0a94578f550026cf41e532e6e0f41.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.178 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: , We are immediately updating sampling rate for already queued-works, only if the new expiry is lesser than the old one. But what about the case, where the user doesn't want frequent events and want to increase sampling time immediately? Shouldn't we cancel the works (and so their interrupts) on all policy->cpus (which might occur very shortly). This patch removes this special case and simplifies code by immediately updating the expiry. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq_ondemand.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 03ac6ce54042..bf0511a9735c 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c @@ -231,17 +231,8 @@ static unsigned int od_dbs_timer(struct cpu_dbs_info *cdbs, static struct common_dbs_data od_dbs_cdata; /** - * update_sampling_rate - update sampling rate effective immediately if needed. + * update_sampling_rate - update sampling rate immediately. * @new_rate: new sampling rate - * - * If new rate is smaller than the old, simply updating - * dbs_tuners_int.sampling_rate might not be appropriate. For example, if the - * original sampling_rate was 1 second and the requested new sampling rate is 10 - * ms because the user needs immediate reaction from ondemand governor, but not - * sure if higher frequency will be required or not, then, the governor may - * change the sampling rate too late; up to 1 second later. Thus, if we are - * reducing the sampling rate, we need to make the new value effective - * immediately. */ static void update_sampling_rate(struct dbs_data *dbs_data, unsigned int new_rate) @@ -255,7 +246,6 @@ static void update_sampling_rate(struct dbs_data *dbs_data, for_each_online_cpu(cpu) { struct cpufreq_policy *policy; struct od_cpu_dbs_info_s *dbs_info; - unsigned long next_sampling, appointed_at; policy = cpufreq_cpu_get(cpu); if (!policy) @@ -270,16 +260,9 @@ static void update_sampling_rate(struct dbs_data *dbs_data, 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)) { - cancel_delayed_work_sync(&dbs_info->cdbs.dwork); - - gov_queue_work(dbs_data, policy, - usecs_to_jiffies(new_rate), true); - - } + cancel_delayed_work_sync(&dbs_info->cdbs.dwork); + gov_queue_work(dbs_data, policy, usecs_to_jiffies(new_rate), + true); } }