Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752874AbdI3HVs (ORCPT ); Sat, 30 Sep 2017 03:21:48 -0400 Received: from mga01.intel.com ([192.55.52.88]:36037 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751644AbdI3HVp (ORCPT ); Sat, 30 Sep 2017 03:21:45 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,456,1500966000"; d="scan'208";a="1020089323" From: Aubrey Li To: tglx@linutronix.de, peterz@infradead.org, rjw@rjwysocki.net, len.brown@intel.com, ak@linux.intel.com, tim.c.chen@linux.intel.com Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Aubrey Li , Aubrey Li Subject: [RFC PATCH v2 6/8] cpuidle: make fast idle threshold tunable Date: Sat, 30 Sep 2017 15:20:32 +0800 Message-Id: <1506756034-6340-7-git-send-email-aubrey.li@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506756034-6340-1-git-send-email-aubrey.li@intel.com> References: <1506756034-6340-1-git-send-email-aubrey.li@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2005 Lines: 74 Add a knob to make fast idle threshold tunable Signed-off-by: Aubrey Li --- drivers/cpuidle/cpuidle.c | 3 ++- include/linux/cpuidle.h | 1 + kernel/sysctl.c | 12 ++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 6cb7e17..5d4f0b6 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -35,6 +35,7 @@ LIST_HEAD(cpuidle_detected_devices); static int enabled_devices; static int off __read_mostly; static int initialized __read_mostly; +int sysctl_fast_idle_ratio = 10; int cpuidle_disabled(void) { @@ -346,7 +347,7 @@ void cpuidle_predict(void) if (!dev) return; - overhead_threshold = dev->idle_stat.overhead; + overhead_threshold = dev->idle_stat.overhead * sysctl_fast_idle_ratio; if (cpuidle_curr_governor->predict) { dev->idle_stat.predicted_us = cpuidle_curr_governor->predict(); diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 791db15..45b8264 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -24,6 +24,7 @@ struct module; struct cpuidle_device; struct cpuidle_driver; +extern int sysctl_fast_idle_ratio; /**************************** * CPUIDLE DEVICE INTERFACE * diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 6648fbb..97f7e8af 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -67,6 +67,7 @@ #include #include #include +#include #include #include @@ -1229,6 +1230,17 @@ static struct ctl_table kern_table[] = { .extra2 = &one, }, #endif +#ifdef CONFIG_CPU_IDLE + { + .procname = "fast_idle_ratio", + .data = &sysctl_fast_idle_ratio, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = &one, + .extra2 = &one_hundred, + }, +#endif { } }; -- 2.7.4