From patchwork Thu Dec 23 06:23:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Youquan Song X-Patchwork-Id: 429121 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBNJ5f3a026223 for ; Thu, 23 Dec 2010 19:05:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752111Ab0LWGVT (ORCPT ); Thu, 23 Dec 2010 01:21:19 -0500 Received: from mga02.intel.com ([134.134.136.20]:28796 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751985Ab0LWGVS (ORCPT ); Thu, 23 Dec 2010 01:21:18 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 22 Dec 2010 22:21:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.60,217,1291622400"; d="scan'208";a="690075302" Received: from linux-otc0903.bj.intel.com (HELO localhost.localdomain) ([10.238.154.141]) by orsmga001.jf.intel.com with ESMTP; 22 Dec 2010 22:21:08 -0800 From: Youquan Song To: davej@redhat.com, cpufreq@vger.kernel.org Cc: venki@google.com, arjan@linux.intel.com, lenb@kernel.org, suresh.b.siddha@intel.com, kent.liu@intel.com, chaohong.guo@intel.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Youquan Song , Youquan Song Subject: [PATCH 3/6] cpufreq: Add roll back non-sampling_window Date: Thu, 23 Dec 2010 14:23:41 +0800 Message-Id: <1293085424-18212-4-git-send-email-youquan.song@intel.com> X-Mailer: git-send-email 1.6.4.2 In-Reply-To: <1293085424-18212-3-git-send-email-youquan.song@intel.com> References: <1293085424-18212-1-git-send-email-youquan.song@intel.com> <1293085424-18212-2-git-send-email-youquan.song@intel.com> <1293085424-18212-3-git-send-email-youquan.song@intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 23 Dec 2010 19:05:51 +0000 (UTC) diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 87aec7f..5242d24 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c @@ -469,11 +469,24 @@ static ssize_t store_sampling_window(struct kobject *a, struct attribute *b, if (input > 1000000) input = 1000000; - if (input < 10000) - input = 10000; + if (input < dbs_tuners_ins.sampling_rate) + input = dbs_tuners_ins.sampling_rate; mutex_lock(&dbs_mutex); dbs_tuners_ins.sampling_window = input; + /* User set sampling window equal default sampling rate, + * It means that user want disable sampling window, so + * return to legacy sampling mode + * */ + if (input == dbs_tuners_ins.sampling_rate) { + dbs_tuners_ins.up_threshold = MICRO_FREQUENCY_UP_THRESHOLD; + dbs_tuners_ins.down_differential = + MICRO_FREQUENCY_DOWN_DIFFERENTIAL; + } else { + dbs_tuners_ins.up_threshold = SAMPLING_WINDOW_UP_THRESHOLD; + dbs_tuners_ins.down_differential = + SAMPLING_WINDOW_DOWN_DIFFERENTIAL; + } mutex_unlock(&dbs_mutex); return count; @@ -720,7 +733,8 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) } } - if (sampling_window_enable) + if (sampling_window_enable && (dbs_tuners_ins.sampling_window != + dbs_tuners_ins.sampling_rate)) /* Get the average load in the lastest sampling window */ max_load_freq = get_load_freq_during_sampling_window( this_dbs_info, max_load_freq,