All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] sched: Add tunable capacity margin for fis_capacity
@ 2021-06-16 15:05 ` YT Chang
  0 siblings, 0 replies; 10+ messages in thread
From: YT Chang @ 2021-06-16 15:05 UTC (permalink / raw)
  To: YT Chang, Rafael J. Wysocki, Viresh Kumar, Luis Chamberlain,
	Kees Cook, Iurii Zaikin, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Matthias Brugger,
	Paul Turner, Qais Yousef, Greg Kroah-Hartman
  Cc: linux-pm, linux-kernel, linux-fsdevel, linux-arm-kernel,
	linux-mediatek, wsd_upstream

Currently, the margin of cpu frequency raising and cpu overutilized are
hard-coded as 25% (1280/1024). Make the margin tunable
to control the aggressive for placement and frequency control. Such as
for power tuning framework could adjust smaller margin to slow down
frequency raising speed and let task stay in smaller cpu.

For light loading scenarios, like beach buggy blitz and messaging apps,
the app threads are moved big core with 25% margin and causing
unnecessary power.
With 0% capacity margin (1024/1024), the app threads could be kept in
little core and deliver better power results without any fps drop.

capacity margin        0%          10%          20%          30%
                     current        current       current      current
                  Fps  (mA)    Fps    (mA)   Fps   (mA)    Fps  (mA)
Beach buggy blitz  60 198.164  60   203.211  60   209.984  60  213.374
Yahoo browser      60 232.301 59.97 237.52  59.95 248.213  60  262.809

Change-Id: Iba48c556ed1b73c9a2699e9e809bc7d9333dc004
Signed-off-by: YT Chang <yt.chang@mediatek.com>
---
 include/linux/sched/cpufreq.h | 19 +++++++++++++++++++
 include/linux/sched/sysctl.h  |  1 +
 include/linux/sysctl.h        |  1 +
 kernel/sched/fair.c           |  4 +++-
 kernel/sysctl.c               | 15 +++++++++++++++
 5 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/include/linux/sched/cpufreq.h b/include/linux/sched/cpufreq.h
index 6205578..8a6c23a1 100644
--- a/include/linux/sched/cpufreq.h
+++ b/include/linux/sched/cpufreq.h
@@ -23,6 +23,23 @@ void cpufreq_add_update_util_hook(int cpu, struct update_util_data *data,
 void cpufreq_remove_update_util_hook(int cpu);
 bool cpufreq_this_cpu_can_update(struct cpufreq_policy *policy);
 
+#ifdef CONFIG_SMP
+extern unsigned int sysctl_sched_capacity_margin;
+
+static inline unsigned long map_util_freq(unsigned long util,
+					  unsigned long freq, unsigned long cap)
+{
+	freq = freq * util / cap;
+	freq = freq * sysctl_sched_capacity_margin / SCHED_CAPACITY_SCALE;
+
+	return freq;
+}
+
+static inline unsigned long map_util_perf(unsigned long util)
+{
+	return util * sysctl_sched_capacity_margin / SCHED_CAPACITY_SCALE;
+}
+#else
 static inline unsigned long map_util_freq(unsigned long util,
 					unsigned long freq, unsigned long cap)
 {
@@ -33,6 +50,8 @@ static inline unsigned long map_util_perf(unsigned long util)
 {
 	return util + (util >> 2);
 }
+#endif
+
 #endif /* CONFIG_CPU_FREQ */
 
 #endif /* _LINUX_SCHED_CPUFREQ_H */
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index db2c0f3..5dee024 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -10,6 +10,7 @@
 
 #ifdef CONFIG_SMP
 extern unsigned int sysctl_hung_task_all_cpu_backtrace;
+extern unsigned int sysctl_sched_capacity_margin;
 #else
 #define sysctl_hung_task_all_cpu_backtrace 0
 #endif /* CONFIG_SMP */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index d99ca99..af6d70f 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -41,6 +41,7 @@
 #define SYSCTL_ZERO	((void *)&sysctl_vals[0])
 #define SYSCTL_ONE	((void *)&sysctl_vals[1])
 #define SYSCTL_INT_MAX	((void *)&sysctl_vals[2])
+#define SCHED_CAPACITY_MARGIN_MIN   1024
 
 extern const int sysctl_vals[];
 
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 20aa234..609b431 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -111,7 +111,9 @@ int __weak arch_asym_cpu_priority(int cpu)
  *
  * (default: ~20%)
  */
-#define fits_capacity(cap, max)	((cap) * 1280 < (max) * 1024)
+unsigned int sysctl_sched_capacity_margin = 1280;
+EXPORT_SYMBOL_GPL(sysctl_sched_capacity_margin);
+#define fits_capacity(cap, max)	((cap) * sysctl_sched_capacity_margin < (max) * 1024)
 
 /*
  * The margin used when comparing CPU capacities.
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 14edf84..d6d2b84 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -127,6 +127,11 @@
 static int six_hundred_forty_kb = 640 * 1024;
 #endif
 
+/* this is needed for the proc of sysctl_sched_capacity_margin */
+#ifdef CONFIG_SMP
+static int min_sched_capacity_margin = 1024;
+#endif /* CONFIG_SMP */
+
 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
 static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
 
@@ -1716,6 +1721,16 @@ int proc_do_static_key(struct ctl_table *table, int write,
 		.mode		= 0644,
 		.proc_handler	= proc_dointvec,
 	},
+#ifdef CONFIG_SMP
+	{
+		.procname	= "sched_capcity_margin",
+		.data		= &sysctl_sched_capacity_margin,
+		.maxlen		= sizeof(unsigned int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= &min_sched_capacity_margin,
+	},
+#endif
 #ifdef CONFIG_SCHEDSTATS
 	{
 		.procname	= "sched_schedstats",
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 1/1] sched: Add tunable capacity margin for fis_capacity
@ 2021-06-16 15:05 ` YT Chang
  0 siblings, 0 replies; 10+ messages in thread
From: YT Chang @ 2021-06-16 15:05 UTC (permalink / raw)
  To: YT Chang, Rafael J. Wysocki, Viresh Kumar, Luis Chamberlain,
	Kees Cook, Iurii Zaikin, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Matthias Brugger,
	Paul Turner, Qais Yousef, Greg Kroah-Hartman
  Cc: linux-pm, linux-kernel, linux-fsdevel, linux-arm-kernel,
	linux-mediatek, wsd_upstream

Currently, the margin of cpu frequency raising and cpu overutilized are
hard-coded as 25% (1280/1024). Make the margin tunable
to control the aggressive for placement and frequency control. Such as
for power tuning framework could adjust smaller margin to slow down
frequency raising speed and let task stay in smaller cpu.

For light loading scenarios, like beach buggy blitz and messaging apps,
the app threads are moved big core with 25% margin and causing
unnecessary power.
With 0% capacity margin (1024/1024), the app threads could be kept in
little core and deliver better power results without any fps drop.

capacity margin        0%          10%          20%          30%
                     current        current       current      current
                  Fps  (mA)    Fps    (mA)   Fps   (mA)    Fps  (mA)
Beach buggy blitz  60 198.164  60   203.211  60   209.984  60  213.374
Yahoo browser      60 232.301 59.97 237.52  59.95 248.213  60  262.809

Change-Id: Iba48c556ed1b73c9a2699e9e809bc7d9333dc004
Signed-off-by: YT Chang <yt.chang@mediatek.com>
---
 include/linux/sched/cpufreq.h | 19 +++++++++++++++++++
 include/linux/sched/sysctl.h  |  1 +
 include/linux/sysctl.h        |  1 +
 kernel/sched/fair.c           |  4 +++-
 kernel/sysctl.c               | 15 +++++++++++++++
 5 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/include/linux/sched/cpufreq.h b/include/linux/sched/cpufreq.h
index 6205578..8a6c23a1 100644
--- a/include/linux/sched/cpufreq.h
+++ b/include/linux/sched/cpufreq.h
@@ -23,6 +23,23 @@ void cpufreq_add_update_util_hook(int cpu, struct update_util_data *data,
 void cpufreq_remove_update_util_hook(int cpu);
 bool cpufreq_this_cpu_can_update(struct cpufreq_policy *policy);
 
+#ifdef CONFIG_SMP
+extern unsigned int sysctl_sched_capacity_margin;
+
+static inline unsigned long map_util_freq(unsigned long util,
+					  unsigned long freq, unsigned long cap)
+{
+	freq = freq * util / cap;
+	freq = freq * sysctl_sched_capacity_margin / SCHED_CAPACITY_SCALE;
+
+	return freq;
+}
+
+static inline unsigned long map_util_perf(unsigned long util)
+{
+	return util * sysctl_sched_capacity_margin / SCHED_CAPACITY_SCALE;
+}
+#else
 static inline unsigned long map_util_freq(unsigned long util,
 					unsigned long freq, unsigned long cap)
 {
@@ -33,6 +50,8 @@ static inline unsigned long map_util_perf(unsigned long util)
 {
 	return util + (util >> 2);
 }
+#endif
+
 #endif /* CONFIG_CPU_FREQ */
 
 #endif /* _LINUX_SCHED_CPUFREQ_H */
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index db2c0f3..5dee024 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -10,6 +10,7 @@
 
 #ifdef CONFIG_SMP
 extern unsigned int sysctl_hung_task_all_cpu_backtrace;
+extern unsigned int sysctl_sched_capacity_margin;
 #else
 #define sysctl_hung_task_all_cpu_backtrace 0
 #endif /* CONFIG_SMP */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index d99ca99..af6d70f 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -41,6 +41,7 @@
 #define SYSCTL_ZERO	((void *)&sysctl_vals[0])
 #define SYSCTL_ONE	((void *)&sysctl_vals[1])
 #define SYSCTL_INT_MAX	((void *)&sysctl_vals[2])
+#define SCHED_CAPACITY_MARGIN_MIN   1024
 
 extern const int sysctl_vals[];
 
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 20aa234..609b431 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -111,7 +111,9 @@ int __weak arch_asym_cpu_priority(int cpu)
  *
  * (default: ~20%)
  */
-#define fits_capacity(cap, max)	((cap) * 1280 < (max) * 1024)
+unsigned int sysctl_sched_capacity_margin = 1280;
+EXPORT_SYMBOL_GPL(sysctl_sched_capacity_margin);
+#define fits_capacity(cap, max)	((cap) * sysctl_sched_capacity_margin < (max) * 1024)
 
 /*
  * The margin used when comparing CPU capacities.
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 14edf84..d6d2b84 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -127,6 +127,11 @@
 static int six_hundred_forty_kb = 640 * 1024;
 #endif
 
+/* this is needed for the proc of sysctl_sched_capacity_margin */
+#ifdef CONFIG_SMP
+static int min_sched_capacity_margin = 1024;
+#endif /* CONFIG_SMP */
+
 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
 static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
 
@@ -1716,6 +1721,16 @@ int proc_do_static_key(struct ctl_table *table, int write,
 		.mode		= 0644,
 		.proc_handler	= proc_dointvec,
 	},
+#ifdef CONFIG_SMP
+	{
+		.procname	= "sched_capcity_margin",
+		.data		= &sysctl_sched_capacity_margin,
+		.maxlen		= sizeof(unsigned int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= &min_sched_capacity_margin,
+	},
+#endif
 #ifdef CONFIG_SCHEDSTATS
 	{
 		.procname	= "sched_schedstats",
-- 
1.9.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 1/1] sched: Add tunable capacity margin for fis_capacity
@ 2021-06-16 15:05 ` YT Chang
  0 siblings, 0 replies; 10+ messages in thread
From: YT Chang @ 2021-06-16 15:05 UTC (permalink / raw)
  To: YT Chang, Rafael J. Wysocki, Viresh Kumar, Luis Chamberlain,
	Kees Cook, Iurii Zaikin, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Matthias Brugger,
	Paul Turner, Qais Yousef, Greg Kroah-Hartman
  Cc: linux-pm, linux-kernel, linux-fsdevel, linux-arm-kernel,
	linux-mediatek, wsd_upstream

Currently, the margin of cpu frequency raising and cpu overutilized are
hard-coded as 25% (1280/1024). Make the margin tunable
to control the aggressive for placement and frequency control. Such as
for power tuning framework could adjust smaller margin to slow down
frequency raising speed and let task stay in smaller cpu.

For light loading scenarios, like beach buggy blitz and messaging apps,
the app threads are moved big core with 25% margin and causing
unnecessary power.
With 0% capacity margin (1024/1024), the app threads could be kept in
little core and deliver better power results without any fps drop.

capacity margin        0%          10%          20%          30%
                     current        current       current      current
                  Fps  (mA)    Fps    (mA)   Fps   (mA)    Fps  (mA)
Beach buggy blitz  60 198.164  60   203.211  60   209.984  60  213.374
Yahoo browser      60 232.301 59.97 237.52  59.95 248.213  60  262.809

Change-Id: Iba48c556ed1b73c9a2699e9e809bc7d9333dc004
Signed-off-by: YT Chang <yt.chang@mediatek.com>
---
 include/linux/sched/cpufreq.h | 19 +++++++++++++++++++
 include/linux/sched/sysctl.h  |  1 +
 include/linux/sysctl.h        |  1 +
 kernel/sched/fair.c           |  4 +++-
 kernel/sysctl.c               | 15 +++++++++++++++
 5 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/include/linux/sched/cpufreq.h b/include/linux/sched/cpufreq.h
index 6205578..8a6c23a1 100644
--- a/include/linux/sched/cpufreq.h
+++ b/include/linux/sched/cpufreq.h
@@ -23,6 +23,23 @@ void cpufreq_add_update_util_hook(int cpu, struct update_util_data *data,
 void cpufreq_remove_update_util_hook(int cpu);
 bool cpufreq_this_cpu_can_update(struct cpufreq_policy *policy);
 
+#ifdef CONFIG_SMP
+extern unsigned int sysctl_sched_capacity_margin;
+
+static inline unsigned long map_util_freq(unsigned long util,
+					  unsigned long freq, unsigned long cap)
+{
+	freq = freq * util / cap;
+	freq = freq * sysctl_sched_capacity_margin / SCHED_CAPACITY_SCALE;
+
+	return freq;
+}
+
+static inline unsigned long map_util_perf(unsigned long util)
+{
+	return util * sysctl_sched_capacity_margin / SCHED_CAPACITY_SCALE;
+}
+#else
 static inline unsigned long map_util_freq(unsigned long util,
 					unsigned long freq, unsigned long cap)
 {
@@ -33,6 +50,8 @@ static inline unsigned long map_util_perf(unsigned long util)
 {
 	return util + (util >> 2);
 }
+#endif
+
 #endif /* CONFIG_CPU_FREQ */
 
 #endif /* _LINUX_SCHED_CPUFREQ_H */
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index db2c0f3..5dee024 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -10,6 +10,7 @@
 
 #ifdef CONFIG_SMP
 extern unsigned int sysctl_hung_task_all_cpu_backtrace;
+extern unsigned int sysctl_sched_capacity_margin;
 #else
 #define sysctl_hung_task_all_cpu_backtrace 0
 #endif /* CONFIG_SMP */
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index d99ca99..af6d70f 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -41,6 +41,7 @@
 #define SYSCTL_ZERO	((void *)&sysctl_vals[0])
 #define SYSCTL_ONE	((void *)&sysctl_vals[1])
 #define SYSCTL_INT_MAX	((void *)&sysctl_vals[2])
+#define SCHED_CAPACITY_MARGIN_MIN   1024
 
 extern const int sysctl_vals[];
 
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 20aa234..609b431 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -111,7 +111,9 @@ int __weak arch_asym_cpu_priority(int cpu)
  *
  * (default: ~20%)
  */
-#define fits_capacity(cap, max)	((cap) * 1280 < (max) * 1024)
+unsigned int sysctl_sched_capacity_margin = 1280;
+EXPORT_SYMBOL_GPL(sysctl_sched_capacity_margin);
+#define fits_capacity(cap, max)	((cap) * sysctl_sched_capacity_margin < (max) * 1024)
 
 /*
  * The margin used when comparing CPU capacities.
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 14edf84..d6d2b84 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -127,6 +127,11 @@
 static int six_hundred_forty_kb = 640 * 1024;
 #endif
 
+/* this is needed for the proc of sysctl_sched_capacity_margin */
+#ifdef CONFIG_SMP
+static int min_sched_capacity_margin = 1024;
+#endif /* CONFIG_SMP */
+
 /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
 static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
 
@@ -1716,6 +1721,16 @@ int proc_do_static_key(struct ctl_table *table, int write,
 		.mode		= 0644,
 		.proc_handler	= proc_dointvec,
 	},
+#ifdef CONFIG_SMP
+	{
+		.procname	= "sched_capcity_margin",
+		.data		= &sysctl_sched_capacity_margin,
+		.maxlen		= sizeof(unsigned int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= &min_sched_capacity_margin,
+	},
+#endif
 #ifdef CONFIG_SCHEDSTATS
 	{
 		.procname	= "sched_schedstats",
-- 
1.9.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] sched: Add tunable capacity margin for fis_capacity
  2021-06-16 15:05 ` YT Chang
  (?)
@ 2021-06-16 15:22   ` Vincent Guittot
  -1 siblings, 0 replies; 10+ messages in thread
From: Vincent Guittot @ 2021-06-16 15:22 UTC (permalink / raw)
  To: YT Chang
  Cc: Rafael J. Wysocki, Viresh Kumar, Luis Chamberlain, Kees Cook,
	Iurii Zaikin, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Daniel Bristot de Oliveira, Matthias Brugger, Paul Turner,
	Qais Yousef, Greg Kroah-Hartman, open list:THERMAL, linux-kernel,
	linux-fs, LAK, linux-mediatek, wsd_upstream

On Wed, 16 Jun 2021 at 17:06, YT Chang <yt.chang@mediatek.com> wrote:
>
> Currently, the margin of cpu frequency raising and cpu overutilized are
> hard-coded as 25% (1280/1024). Make the margin tunable

cpu_overutilized is 20% not 25%. Even if they light looks similar
these 2 margins are differents

> to control the aggressive for placement and frequency control. Such as
> for power tuning framework could adjust smaller margin to slow down
> frequency raising speed and let task stay in smaller cpu.
>
> For light loading scenarios, like beach buggy blitz and messaging apps,
> the app threads are moved big core with 25% margin and causing
> unnecessary power.
> With 0% capacity margin (1024/1024), the app threads could be kept in
> little core and deliver better power results without any fps drop.
>
> capacity margin        0%          10%          20%          30%
>                      current        current       current      current
>                   Fps  (mA)    Fps    (mA)   Fps   (mA)    Fps  (mA)
> Beach buggy blitz  60 198.164  60   203.211  60   209.984  60  213.374
> Yahoo browser      60 232.301 59.97 237.52  59.95 248.213  60  262.809

Would be good to know the impact of each part:
 Changing the +25% in cpufreq governor
 Changing the 20% margin to detect overloaded CPU

Also, IIUC your description, the current values are ok with some UCs
but not with others like the 2 aboves. Have you evaluated whether it
was not your power model that was not accurate ?

>
> Change-Id: Iba48c556ed1b73c9a2699e9e809bc7d9333dc004
> Signed-off-by: YT Chang <yt.chang@mediatek.com>
> ---
>  include/linux/sched/cpufreq.h | 19 +++++++++++++++++++
>  include/linux/sched/sysctl.h  |  1 +
>  include/linux/sysctl.h        |  1 +
>  kernel/sched/fair.c           |  4 +++-
>  kernel/sysctl.c               | 15 +++++++++++++++
>  5 files changed, 39 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/sched/cpufreq.h b/include/linux/sched/cpufreq.h
> index 6205578..8a6c23a1 100644
> --- a/include/linux/sched/cpufreq.h
> +++ b/include/linux/sched/cpufreq.h
> @@ -23,6 +23,23 @@ void cpufreq_add_update_util_hook(int cpu, struct update_util_data *data,
>  void cpufreq_remove_update_util_hook(int cpu);
>  bool cpufreq_this_cpu_can_update(struct cpufreq_policy *policy);
>
> +#ifdef CONFIG_SMP
> +extern unsigned int sysctl_sched_capacity_margin;
> +
> +static inline unsigned long map_util_freq(unsigned long util,
> +                                         unsigned long freq, unsigned long cap)
> +{
> +       freq = freq * util / cap;
> +       freq = freq * sysctl_sched_capacity_margin / SCHED_CAPACITY_SCALE;
> +
> +       return freq;
> +}
> +
> +static inline unsigned long map_util_perf(unsigned long util)
> +{
> +       return util * sysctl_sched_capacity_margin / SCHED_CAPACITY_SCALE;
> +}
> +#else
>  static inline unsigned long map_util_freq(unsigned long util,
>                                         unsigned long freq, unsigned long cap)
>  {
> @@ -33,6 +50,8 @@ static inline unsigned long map_util_perf(unsigned long util)
>  {
>         return util + (util >> 2);
>  }
> +#endif
> +
>  #endif /* CONFIG_CPU_FREQ */
>
>  #endif /* _LINUX_SCHED_CPUFREQ_H */
> diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
> index db2c0f3..5dee024 100644
> --- a/include/linux/sched/sysctl.h
> +++ b/include/linux/sched/sysctl.h
> @@ -10,6 +10,7 @@
>
>  #ifdef CONFIG_SMP
>  extern unsigned int sysctl_hung_task_all_cpu_backtrace;
> +extern unsigned int sysctl_sched_capacity_margin;
>  #else
>  #define sysctl_hung_task_all_cpu_backtrace 0
>  #endif /* CONFIG_SMP */
> diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
> index d99ca99..af6d70f 100644
> --- a/include/linux/sysctl.h
> +++ b/include/linux/sysctl.h
> @@ -41,6 +41,7 @@
>  #define SYSCTL_ZERO    ((void *)&sysctl_vals[0])
>  #define SYSCTL_ONE     ((void *)&sysctl_vals[1])
>  #define SYSCTL_INT_MAX ((void *)&sysctl_vals[2])
> +#define SCHED_CAPACITY_MARGIN_MIN   1024
>
>  extern const int sysctl_vals[];
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 20aa234..609b431 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -111,7 +111,9 @@ int __weak arch_asym_cpu_priority(int cpu)
>   *
>   * (default: ~20%)
>   */
> -#define fits_capacity(cap, max)        ((cap) * 1280 < (max) * 1024)
> +unsigned int sysctl_sched_capacity_margin = 1280;
> +EXPORT_SYMBOL_GPL(sysctl_sched_capacity_margin);
> +#define fits_capacity(cap, max)        ((cap) * sysctl_sched_capacity_margin < (max) * 1024)
>
>  /*
>   * The margin used when comparing CPU capacities.
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 14edf84..d6d2b84 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -127,6 +127,11 @@
>  static int six_hundred_forty_kb = 640 * 1024;
>  #endif
>
> +/* this is needed for the proc of sysctl_sched_capacity_margin */
> +#ifdef CONFIG_SMP
> +static int min_sched_capacity_margin = 1024;
> +#endif /* CONFIG_SMP */
> +
>  /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
>  static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
>
> @@ -1716,6 +1721,16 @@ int proc_do_static_key(struct ctl_table *table, int write,
>                 .mode           = 0644,
>                 .proc_handler   = proc_dointvec,
>         },
> +#ifdef CONFIG_SMP
> +       {
> +               .procname       = "sched_capcity_margin",
> +               .data           = &sysctl_sched_capacity_margin,
> +               .maxlen         = sizeof(unsigned int),
> +               .mode           = 0644,
> +               .proc_handler   = proc_dointvec_minmax,
> +               .extra1         = &min_sched_capacity_margin,
> +       },
> +#endif
>  #ifdef CONFIG_SCHEDSTATS
>         {
>                 .procname       = "sched_schedstats",
> --
> 1.9.1
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] sched: Add tunable capacity margin for fis_capacity
@ 2021-06-16 15:22   ` Vincent Guittot
  0 siblings, 0 replies; 10+ messages in thread
From: Vincent Guittot @ 2021-06-16 15:22 UTC (permalink / raw)
  To: YT Chang
  Cc: Rafael J. Wysocki, Viresh Kumar, Luis Chamberlain, Kees Cook,
	Iurii Zaikin, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Daniel Bristot de Oliveira, Matthias Brugger, Paul Turner,
	Qais Yousef, Greg Kroah-Hartman, open list:THERMAL, linux-kernel,
	linux-fs, LAK, linux-mediatek, wsd_upstream

On Wed, 16 Jun 2021 at 17:06, YT Chang <yt.chang@mediatek.com> wrote:
>
> Currently, the margin of cpu frequency raising and cpu overutilized are
> hard-coded as 25% (1280/1024). Make the margin tunable

cpu_overutilized is 20% not 25%. Even if they light looks similar
these 2 margins are differents

> to control the aggressive for placement and frequency control. Such as
> for power tuning framework could adjust smaller margin to slow down
> frequency raising speed and let task stay in smaller cpu.
>
> For light loading scenarios, like beach buggy blitz and messaging apps,
> the app threads are moved big core with 25% margin and causing
> unnecessary power.
> With 0% capacity margin (1024/1024), the app threads could be kept in
> little core and deliver better power results without any fps drop.
>
> capacity margin        0%          10%          20%          30%
>                      current        current       current      current
>                   Fps  (mA)    Fps    (mA)   Fps   (mA)    Fps  (mA)
> Beach buggy blitz  60 198.164  60   203.211  60   209.984  60  213.374
> Yahoo browser      60 232.301 59.97 237.52  59.95 248.213  60  262.809

Would be good to know the impact of each part:
 Changing the +25% in cpufreq governor
 Changing the 20% margin to detect overloaded CPU

Also, IIUC your description, the current values are ok with some UCs
but not with others like the 2 aboves. Have you evaluated whether it
was not your power model that was not accurate ?

>
> Change-Id: Iba48c556ed1b73c9a2699e9e809bc7d9333dc004
> Signed-off-by: YT Chang <yt.chang@mediatek.com>
> ---
>  include/linux/sched/cpufreq.h | 19 +++++++++++++++++++
>  include/linux/sched/sysctl.h  |  1 +
>  include/linux/sysctl.h        |  1 +
>  kernel/sched/fair.c           |  4 +++-
>  kernel/sysctl.c               | 15 +++++++++++++++
>  5 files changed, 39 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/sched/cpufreq.h b/include/linux/sched/cpufreq.h
> index 6205578..8a6c23a1 100644
> --- a/include/linux/sched/cpufreq.h
> +++ b/include/linux/sched/cpufreq.h
> @@ -23,6 +23,23 @@ void cpufreq_add_update_util_hook(int cpu, struct update_util_data *data,
>  void cpufreq_remove_update_util_hook(int cpu);
>  bool cpufreq_this_cpu_can_update(struct cpufreq_policy *policy);
>
> +#ifdef CONFIG_SMP
> +extern unsigned int sysctl_sched_capacity_margin;
> +
> +static inline unsigned long map_util_freq(unsigned long util,
> +                                         unsigned long freq, unsigned long cap)
> +{
> +       freq = freq * util / cap;
> +       freq = freq * sysctl_sched_capacity_margin / SCHED_CAPACITY_SCALE;
> +
> +       return freq;
> +}
> +
> +static inline unsigned long map_util_perf(unsigned long util)
> +{
> +       return util * sysctl_sched_capacity_margin / SCHED_CAPACITY_SCALE;
> +}
> +#else
>  static inline unsigned long map_util_freq(unsigned long util,
>                                         unsigned long freq, unsigned long cap)
>  {
> @@ -33,6 +50,8 @@ static inline unsigned long map_util_perf(unsigned long util)
>  {
>         return util + (util >> 2);
>  }
> +#endif
> +
>  #endif /* CONFIG_CPU_FREQ */
>
>  #endif /* _LINUX_SCHED_CPUFREQ_H */
> diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
> index db2c0f3..5dee024 100644
> --- a/include/linux/sched/sysctl.h
> +++ b/include/linux/sched/sysctl.h
> @@ -10,6 +10,7 @@
>
>  #ifdef CONFIG_SMP
>  extern unsigned int sysctl_hung_task_all_cpu_backtrace;
> +extern unsigned int sysctl_sched_capacity_margin;
>  #else
>  #define sysctl_hung_task_all_cpu_backtrace 0
>  #endif /* CONFIG_SMP */
> diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
> index d99ca99..af6d70f 100644
> --- a/include/linux/sysctl.h
> +++ b/include/linux/sysctl.h
> @@ -41,6 +41,7 @@
>  #define SYSCTL_ZERO    ((void *)&sysctl_vals[0])
>  #define SYSCTL_ONE     ((void *)&sysctl_vals[1])
>  #define SYSCTL_INT_MAX ((void *)&sysctl_vals[2])
> +#define SCHED_CAPACITY_MARGIN_MIN   1024
>
>  extern const int sysctl_vals[];
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 20aa234..609b431 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -111,7 +111,9 @@ int __weak arch_asym_cpu_priority(int cpu)
>   *
>   * (default: ~20%)
>   */
> -#define fits_capacity(cap, max)        ((cap) * 1280 < (max) * 1024)
> +unsigned int sysctl_sched_capacity_margin = 1280;
> +EXPORT_SYMBOL_GPL(sysctl_sched_capacity_margin);
> +#define fits_capacity(cap, max)        ((cap) * sysctl_sched_capacity_margin < (max) * 1024)
>
>  /*
>   * The margin used when comparing CPU capacities.
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 14edf84..d6d2b84 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -127,6 +127,11 @@
>  static int six_hundred_forty_kb = 640 * 1024;
>  #endif
>
> +/* this is needed for the proc of sysctl_sched_capacity_margin */
> +#ifdef CONFIG_SMP
> +static int min_sched_capacity_margin = 1024;
> +#endif /* CONFIG_SMP */
> +
>  /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
>  static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
>
> @@ -1716,6 +1721,16 @@ int proc_do_static_key(struct ctl_table *table, int write,
>                 .mode           = 0644,
>                 .proc_handler   = proc_dointvec,
>         },
> +#ifdef CONFIG_SMP
> +       {
> +               .procname       = "sched_capcity_margin",
> +               .data           = &sysctl_sched_capacity_margin,
> +               .maxlen         = sizeof(unsigned int),
> +               .mode           = 0644,
> +               .proc_handler   = proc_dointvec_minmax,
> +               .extra1         = &min_sched_capacity_margin,
> +       },
> +#endif
>  #ifdef CONFIG_SCHEDSTATS
>         {
>                 .procname       = "sched_schedstats",
> --
> 1.9.1
>

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] sched: Add tunable capacity margin for fis_capacity
@ 2021-06-16 15:22   ` Vincent Guittot
  0 siblings, 0 replies; 10+ messages in thread
From: Vincent Guittot @ 2021-06-16 15:22 UTC (permalink / raw)
  To: YT Chang
  Cc: Rafael J. Wysocki, Viresh Kumar, Luis Chamberlain, Kees Cook,
	Iurii Zaikin, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Daniel Bristot de Oliveira, Matthias Brugger, Paul Turner,
	Qais Yousef, Greg Kroah-Hartman, open list:THERMAL, linux-kernel,
	linux-fs, LAK, linux-mediatek, wsd_upstream

On Wed, 16 Jun 2021 at 17:06, YT Chang <yt.chang@mediatek.com> wrote:
>
> Currently, the margin of cpu frequency raising and cpu overutilized are
> hard-coded as 25% (1280/1024). Make the margin tunable

cpu_overutilized is 20% not 25%. Even if they light looks similar
these 2 margins are differents

> to control the aggressive for placement and frequency control. Such as
> for power tuning framework could adjust smaller margin to slow down
> frequency raising speed and let task stay in smaller cpu.
>
> For light loading scenarios, like beach buggy blitz and messaging apps,
> the app threads are moved big core with 25% margin and causing
> unnecessary power.
> With 0% capacity margin (1024/1024), the app threads could be kept in
> little core and deliver better power results without any fps drop.
>
> capacity margin        0%          10%          20%          30%
>                      current        current       current      current
>                   Fps  (mA)    Fps    (mA)   Fps   (mA)    Fps  (mA)
> Beach buggy blitz  60 198.164  60   203.211  60   209.984  60  213.374
> Yahoo browser      60 232.301 59.97 237.52  59.95 248.213  60  262.809

Would be good to know the impact of each part:
 Changing the +25% in cpufreq governor
 Changing the 20% margin to detect overloaded CPU

Also, IIUC your description, the current values are ok with some UCs
but not with others like the 2 aboves. Have you evaluated whether it
was not your power model that was not accurate ?

>
> Change-Id: Iba48c556ed1b73c9a2699e9e809bc7d9333dc004
> Signed-off-by: YT Chang <yt.chang@mediatek.com>
> ---
>  include/linux/sched/cpufreq.h | 19 +++++++++++++++++++
>  include/linux/sched/sysctl.h  |  1 +
>  include/linux/sysctl.h        |  1 +
>  kernel/sched/fair.c           |  4 +++-
>  kernel/sysctl.c               | 15 +++++++++++++++
>  5 files changed, 39 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/sched/cpufreq.h b/include/linux/sched/cpufreq.h
> index 6205578..8a6c23a1 100644
> --- a/include/linux/sched/cpufreq.h
> +++ b/include/linux/sched/cpufreq.h
> @@ -23,6 +23,23 @@ void cpufreq_add_update_util_hook(int cpu, struct update_util_data *data,
>  void cpufreq_remove_update_util_hook(int cpu);
>  bool cpufreq_this_cpu_can_update(struct cpufreq_policy *policy);
>
> +#ifdef CONFIG_SMP
> +extern unsigned int sysctl_sched_capacity_margin;
> +
> +static inline unsigned long map_util_freq(unsigned long util,
> +                                         unsigned long freq, unsigned long cap)
> +{
> +       freq = freq * util / cap;
> +       freq = freq * sysctl_sched_capacity_margin / SCHED_CAPACITY_SCALE;
> +
> +       return freq;
> +}
> +
> +static inline unsigned long map_util_perf(unsigned long util)
> +{
> +       return util * sysctl_sched_capacity_margin / SCHED_CAPACITY_SCALE;
> +}
> +#else
>  static inline unsigned long map_util_freq(unsigned long util,
>                                         unsigned long freq, unsigned long cap)
>  {
> @@ -33,6 +50,8 @@ static inline unsigned long map_util_perf(unsigned long util)
>  {
>         return util + (util >> 2);
>  }
> +#endif
> +
>  #endif /* CONFIG_CPU_FREQ */
>
>  #endif /* _LINUX_SCHED_CPUFREQ_H */
> diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
> index db2c0f3..5dee024 100644
> --- a/include/linux/sched/sysctl.h
> +++ b/include/linux/sched/sysctl.h
> @@ -10,6 +10,7 @@
>
>  #ifdef CONFIG_SMP
>  extern unsigned int sysctl_hung_task_all_cpu_backtrace;
> +extern unsigned int sysctl_sched_capacity_margin;
>  #else
>  #define sysctl_hung_task_all_cpu_backtrace 0
>  #endif /* CONFIG_SMP */
> diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
> index d99ca99..af6d70f 100644
> --- a/include/linux/sysctl.h
> +++ b/include/linux/sysctl.h
> @@ -41,6 +41,7 @@
>  #define SYSCTL_ZERO    ((void *)&sysctl_vals[0])
>  #define SYSCTL_ONE     ((void *)&sysctl_vals[1])
>  #define SYSCTL_INT_MAX ((void *)&sysctl_vals[2])
> +#define SCHED_CAPACITY_MARGIN_MIN   1024
>
>  extern const int sysctl_vals[];
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 20aa234..609b431 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -111,7 +111,9 @@ int __weak arch_asym_cpu_priority(int cpu)
>   *
>   * (default: ~20%)
>   */
> -#define fits_capacity(cap, max)        ((cap) * 1280 < (max) * 1024)
> +unsigned int sysctl_sched_capacity_margin = 1280;
> +EXPORT_SYMBOL_GPL(sysctl_sched_capacity_margin);
> +#define fits_capacity(cap, max)        ((cap) * sysctl_sched_capacity_margin < (max) * 1024)
>
>  /*
>   * The margin used when comparing CPU capacities.
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 14edf84..d6d2b84 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -127,6 +127,11 @@
>  static int six_hundred_forty_kb = 640 * 1024;
>  #endif
>
> +/* this is needed for the proc of sysctl_sched_capacity_margin */
> +#ifdef CONFIG_SMP
> +static int min_sched_capacity_margin = 1024;
> +#endif /* CONFIG_SMP */
> +
>  /* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
>  static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
>
> @@ -1716,6 +1721,16 @@ int proc_do_static_key(struct ctl_table *table, int write,
>                 .mode           = 0644,
>                 .proc_handler   = proc_dointvec,
>         },
> +#ifdef CONFIG_SMP
> +       {
> +               .procname       = "sched_capcity_margin",
> +               .data           = &sysctl_sched_capacity_margin,
> +               .maxlen         = sizeof(unsigned int),
> +               .mode           = 0644,
> +               .proc_handler   = proc_dointvec_minmax,
> +               .extra1         = &min_sched_capacity_margin,
> +       },
> +#endif
>  #ifdef CONFIG_SCHEDSTATS
>         {
>                 .procname       = "sched_schedstats",
> --
> 1.9.1
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] sched: Add tunable capacity margin for fis_capacity
  2021-06-16 15:05 ` YT Chang
                   ` (2 preceding siblings ...)
  (?)
@ 2021-06-17 17:56 ` kernel test robot
  -1 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2021-06-17 17:56 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 21635 bytes --]

Hi YT,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on pm/linux-next]
[also build test ERROR on tip/sched/core kees/for-next/pstore linus/master v5.13-rc6 next-20210617]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/YT-Chang/sched-Add-tunable-capacity-margin-for-fis_capacity/20210617-101010
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
config: x86_64-randconfig-b001-20210617 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 64720f57bea6a6bf033feef4a5751ab9c0c3b401)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/5f9a234696d4aef51f1f2b506e7724760bb0f907
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review YT-Chang/sched-Add-tunable-capacity-margin-for-fis_capacity/20210617-101010
        git checkout 5f9a234696d4aef51f1f2b506e7724760bb0f907
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> kernel/sysctl.c:1747:13: error: use of undeclared identifier 'sysctl_sched_capacity_margin'; did you mean 'min_sched_capacity_margin'?
                   .data           = &sysctl_sched_capacity_margin,
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                      min_sched_capacity_margin
   kernel/sysctl.c:132:12: note: 'min_sched_capacity_margin' declared here
   static int min_sched_capacity_margin = 1024;
              ^
   1 error generated.


vim +1747 kernel/sysctl.c

  1735	
  1736	static struct ctl_table kern_table[] = {
  1737		{
  1738			.procname	= "sched_child_runs_first",
  1739			.data		= &sysctl_sched_child_runs_first,
  1740			.maxlen		= sizeof(unsigned int),
  1741			.mode		= 0644,
  1742			.proc_handler	= proc_dointvec,
  1743		},
  1744	#ifdef CONFIG_SMP
  1745		{
  1746			.procname	= "sched_capcity_margin",
> 1747			.data		= &sysctl_sched_capacity_margin,
  1748			.maxlen		= sizeof(unsigned int),
  1749			.mode		= 0644,
  1750			.proc_handler	= proc_dointvec_minmax,
  1751			.extra1		= &min_sched_capacity_margin,
  1752		},
  1753	#endif
  1754	#ifdef CONFIG_SCHEDSTATS
  1755		{
  1756			.procname	= "sched_schedstats",
  1757			.data		= NULL,
  1758			.maxlen		= sizeof(unsigned int),
  1759			.mode		= 0644,
  1760			.proc_handler	= sysctl_schedstats,
  1761			.extra1		= SYSCTL_ZERO,
  1762			.extra2		= SYSCTL_ONE,
  1763		},
  1764	#endif /* CONFIG_SCHEDSTATS */
  1765	#ifdef CONFIG_NUMA_BALANCING
  1766		{
  1767			.procname	= "numa_balancing",
  1768			.data		= NULL, /* filled in by handler */
  1769			.maxlen		= sizeof(unsigned int),
  1770			.mode		= 0644,
  1771			.proc_handler	= sysctl_numa_balancing,
  1772			.extra1		= SYSCTL_ZERO,
  1773			.extra2		= SYSCTL_ONE,
  1774		},
  1775	#endif /* CONFIG_NUMA_BALANCING */
  1776		{
  1777			.procname	= "sched_rt_period_us",
  1778			.data		= &sysctl_sched_rt_period,
  1779			.maxlen		= sizeof(unsigned int),
  1780			.mode		= 0644,
  1781			.proc_handler	= sched_rt_handler,
  1782		},
  1783		{
  1784			.procname	= "sched_rt_runtime_us",
  1785			.data		= &sysctl_sched_rt_runtime,
  1786			.maxlen		= sizeof(int),
  1787			.mode		= 0644,
  1788			.proc_handler	= sched_rt_handler,
  1789		},
  1790		{
  1791			.procname	= "sched_deadline_period_max_us",
  1792			.data		= &sysctl_sched_dl_period_max,
  1793			.maxlen		= sizeof(unsigned int),
  1794			.mode		= 0644,
  1795			.proc_handler	= proc_dointvec,
  1796		},
  1797		{
  1798			.procname	= "sched_deadline_period_min_us",
  1799			.data		= &sysctl_sched_dl_period_min,
  1800			.maxlen		= sizeof(unsigned int),
  1801			.mode		= 0644,
  1802			.proc_handler	= proc_dointvec,
  1803		},
  1804		{
  1805			.procname	= "sched_rr_timeslice_ms",
  1806			.data		= &sysctl_sched_rr_timeslice,
  1807			.maxlen		= sizeof(int),
  1808			.mode		= 0644,
  1809			.proc_handler	= sched_rr_handler,
  1810		},
  1811	#ifdef CONFIG_UCLAMP_TASK
  1812		{
  1813			.procname	= "sched_util_clamp_min",
  1814			.data		= &sysctl_sched_uclamp_util_min,
  1815			.maxlen		= sizeof(unsigned int),
  1816			.mode		= 0644,
  1817			.proc_handler	= sysctl_sched_uclamp_handler,
  1818		},
  1819		{
  1820			.procname	= "sched_util_clamp_max",
  1821			.data		= &sysctl_sched_uclamp_util_max,
  1822			.maxlen		= sizeof(unsigned int),
  1823			.mode		= 0644,
  1824			.proc_handler	= sysctl_sched_uclamp_handler,
  1825		},
  1826		{
  1827			.procname	= "sched_util_clamp_min_rt_default",
  1828			.data		= &sysctl_sched_uclamp_util_min_rt_default,
  1829			.maxlen		= sizeof(unsigned int),
  1830			.mode		= 0644,
  1831			.proc_handler	= sysctl_sched_uclamp_handler,
  1832		},
  1833	#endif
  1834	#ifdef CONFIG_SCHED_AUTOGROUP
  1835		{
  1836			.procname	= "sched_autogroup_enabled",
  1837			.data		= &sysctl_sched_autogroup_enabled,
  1838			.maxlen		= sizeof(unsigned int),
  1839			.mode		= 0644,
  1840			.proc_handler	= proc_dointvec_minmax,
  1841			.extra1		= SYSCTL_ZERO,
  1842			.extra2		= SYSCTL_ONE,
  1843		},
  1844	#endif
  1845	#ifdef CONFIG_CFS_BANDWIDTH
  1846		{
  1847			.procname	= "sched_cfs_bandwidth_slice_us",
  1848			.data		= &sysctl_sched_cfs_bandwidth_slice,
  1849			.maxlen		= sizeof(unsigned int),
  1850			.mode		= 0644,
  1851			.proc_handler	= proc_dointvec_minmax,
  1852			.extra1		= SYSCTL_ONE,
  1853		},
  1854	#endif
  1855	#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
  1856		{
  1857			.procname	= "sched_energy_aware",
  1858			.data		= &sysctl_sched_energy_aware,
  1859			.maxlen		= sizeof(unsigned int),
  1860			.mode		= 0644,
  1861			.proc_handler	= sched_energy_aware_handler,
  1862			.extra1		= SYSCTL_ZERO,
  1863			.extra2		= SYSCTL_ONE,
  1864		},
  1865	#endif
  1866	#ifdef CONFIG_PROVE_LOCKING
  1867		{
  1868			.procname	= "prove_locking",
  1869			.data		= &prove_locking,
  1870			.maxlen		= sizeof(int),
  1871			.mode		= 0644,
  1872			.proc_handler	= proc_dointvec,
  1873		},
  1874	#endif
  1875	#ifdef CONFIG_LOCK_STAT
  1876		{
  1877			.procname	= "lock_stat",
  1878			.data		= &lock_stat,
  1879			.maxlen		= sizeof(int),
  1880			.mode		= 0644,
  1881			.proc_handler	= proc_dointvec,
  1882		},
  1883	#endif
  1884		{
  1885			.procname	= "panic",
  1886			.data		= &panic_timeout,
  1887			.maxlen		= sizeof(int),
  1888			.mode		= 0644,
  1889			.proc_handler	= proc_dointvec,
  1890		},
  1891	#ifdef CONFIG_COREDUMP
  1892		{
  1893			.procname	= "core_uses_pid",
  1894			.data		= &core_uses_pid,
  1895			.maxlen		= sizeof(int),
  1896			.mode		= 0644,
  1897			.proc_handler	= proc_dointvec,
  1898		},
  1899		{
  1900			.procname	= "core_pattern",
  1901			.data		= core_pattern,
  1902			.maxlen		= CORENAME_MAX_SIZE,
  1903			.mode		= 0644,
  1904			.proc_handler	= proc_dostring_coredump,
  1905		},
  1906		{
  1907			.procname	= "core_pipe_limit",
  1908			.data		= &core_pipe_limit,
  1909			.maxlen		= sizeof(unsigned int),
  1910			.mode		= 0644,
  1911			.proc_handler	= proc_dointvec,
  1912		},
  1913	#endif
  1914	#ifdef CONFIG_PROC_SYSCTL
  1915		{
  1916			.procname	= "tainted",
  1917			.maxlen 	= sizeof(long),
  1918			.mode		= 0644,
  1919			.proc_handler	= proc_taint,
  1920		},
  1921		{
  1922			.procname	= "sysctl_writes_strict",
  1923			.data		= &sysctl_writes_strict,
  1924			.maxlen		= sizeof(int),
  1925			.mode		= 0644,
  1926			.proc_handler	= proc_dointvec_minmax,
  1927			.extra1		= &neg_one,
  1928			.extra2		= SYSCTL_ONE,
  1929		},
  1930	#endif
  1931	#ifdef CONFIG_LATENCYTOP
  1932		{
  1933			.procname	= "latencytop",
  1934			.data		= &latencytop_enabled,
  1935			.maxlen		= sizeof(int),
  1936			.mode		= 0644,
  1937			.proc_handler	= sysctl_latencytop,
  1938		},
  1939	#endif
  1940	#ifdef CONFIG_BLK_DEV_INITRD
  1941		{
  1942			.procname	= "real-root-dev",
  1943			.data		= &real_root_dev,
  1944			.maxlen		= sizeof(int),
  1945			.mode		= 0644,
  1946			.proc_handler	= proc_dointvec,
  1947		},
  1948	#endif
  1949		{
  1950			.procname	= "print-fatal-signals",
  1951			.data		= &print_fatal_signals,
  1952			.maxlen		= sizeof(int),
  1953			.mode		= 0644,
  1954			.proc_handler	= proc_dointvec,
  1955		},
  1956	#ifdef CONFIG_SPARC
  1957		{
  1958			.procname	= "reboot-cmd",
  1959			.data		= reboot_command,
  1960			.maxlen		= 256,
  1961			.mode		= 0644,
  1962			.proc_handler	= proc_dostring,
  1963		},
  1964		{
  1965			.procname	= "stop-a",
  1966			.data		= &stop_a_enabled,
  1967			.maxlen		= sizeof (int),
  1968			.mode		= 0644,
  1969			.proc_handler	= proc_dointvec,
  1970		},
  1971		{
  1972			.procname	= "scons-poweroff",
  1973			.data		= &scons_pwroff,
  1974			.maxlen		= sizeof (int),
  1975			.mode		= 0644,
  1976			.proc_handler	= proc_dointvec,
  1977		},
  1978	#endif
  1979	#ifdef CONFIG_SPARC64
  1980		{
  1981			.procname	= "tsb-ratio",
  1982			.data		= &sysctl_tsb_ratio,
  1983			.maxlen		= sizeof (int),
  1984			.mode		= 0644,
  1985			.proc_handler	= proc_dointvec,
  1986		},
  1987	#endif
  1988	#ifdef CONFIG_PARISC
  1989		{
  1990			.procname	= "soft-power",
  1991			.data		= &pwrsw_enabled,
  1992			.maxlen		= sizeof (int),
  1993			.mode		= 0644,
  1994			.proc_handler	= proc_dointvec,
  1995		},
  1996	#endif
  1997	#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
  1998		{
  1999			.procname	= "unaligned-trap",
  2000			.data		= &unaligned_enabled,
  2001			.maxlen		= sizeof (int),
  2002			.mode		= 0644,
  2003			.proc_handler	= proc_dointvec,
  2004		},
  2005	#endif
  2006		{
  2007			.procname	= "ctrl-alt-del",
  2008			.data		= &C_A_D,
  2009			.maxlen		= sizeof(int),
  2010			.mode		= 0644,
  2011			.proc_handler	= proc_dointvec,
  2012		},
  2013	#ifdef CONFIG_FUNCTION_TRACER
  2014		{
  2015			.procname	= "ftrace_enabled",
  2016			.data		= &ftrace_enabled,
  2017			.maxlen		= sizeof(int),
  2018			.mode		= 0644,
  2019			.proc_handler	= ftrace_enable_sysctl,
  2020		},
  2021	#endif
  2022	#ifdef CONFIG_STACK_TRACER
  2023		{
  2024			.procname	= "stack_tracer_enabled",
  2025			.data		= &stack_tracer_enabled,
  2026			.maxlen		= sizeof(int),
  2027			.mode		= 0644,
  2028			.proc_handler	= stack_trace_sysctl,
  2029		},
  2030	#endif
  2031	#ifdef CONFIG_TRACING
  2032		{
  2033			.procname	= "ftrace_dump_on_oops",
  2034			.data		= &ftrace_dump_on_oops,
  2035			.maxlen		= sizeof(int),
  2036			.mode		= 0644,
  2037			.proc_handler	= proc_dointvec,
  2038		},
  2039		{
  2040			.procname	= "traceoff_on_warning",
  2041			.data		= &__disable_trace_on_warning,
  2042			.maxlen		= sizeof(__disable_trace_on_warning),
  2043			.mode		= 0644,
  2044			.proc_handler	= proc_dointvec,
  2045		},
  2046		{
  2047			.procname	= "tracepoint_printk",
  2048			.data		= &tracepoint_printk,
  2049			.maxlen		= sizeof(tracepoint_printk),
  2050			.mode		= 0644,
  2051			.proc_handler	= tracepoint_printk_sysctl,
  2052		},
  2053	#endif
  2054	#ifdef CONFIG_KEXEC_CORE
  2055		{
  2056			.procname	= "kexec_load_disabled",
  2057			.data		= &kexec_load_disabled,
  2058			.maxlen		= sizeof(int),
  2059			.mode		= 0644,
  2060			/* only handle a transition from default "0" to "1" */
  2061			.proc_handler	= proc_dointvec_minmax,
  2062			.extra1		= SYSCTL_ONE,
  2063			.extra2		= SYSCTL_ONE,
  2064		},
  2065	#endif
  2066	#ifdef CONFIG_MODULES
  2067		{
  2068			.procname	= "modprobe",
  2069			.data		= &modprobe_path,
  2070			.maxlen		= KMOD_PATH_LEN,
  2071			.mode		= 0644,
  2072			.proc_handler	= proc_dostring,
  2073		},
  2074		{
  2075			.procname	= "modules_disabled",
  2076			.data		= &modules_disabled,
  2077			.maxlen		= sizeof(int),
  2078			.mode		= 0644,
  2079			/* only handle a transition from default "0" to "1" */
  2080			.proc_handler	= proc_dointvec_minmax,
  2081			.extra1		= SYSCTL_ONE,
  2082			.extra2		= SYSCTL_ONE,
  2083		},
  2084	#endif
  2085	#ifdef CONFIG_UEVENT_HELPER
  2086		{
  2087			.procname	= "hotplug",
  2088			.data		= &uevent_helper,
  2089			.maxlen		= UEVENT_HELPER_PATH_LEN,
  2090			.mode		= 0644,
  2091			.proc_handler	= proc_dostring,
  2092		},
  2093	#endif
  2094	#ifdef CONFIG_CHR_DEV_SG
  2095		{
  2096			.procname	= "sg-big-buff",
  2097			.data		= &sg_big_buff,
  2098			.maxlen		= sizeof (int),
  2099			.mode		= 0444,
  2100			.proc_handler	= proc_dointvec,
  2101		},
  2102	#endif
  2103	#ifdef CONFIG_BSD_PROCESS_ACCT
  2104		{
  2105			.procname	= "acct",
  2106			.data		= &acct_parm,
  2107			.maxlen		= 3*sizeof(int),
  2108			.mode		= 0644,
  2109			.proc_handler	= proc_dointvec,
  2110		},
  2111	#endif
  2112	#ifdef CONFIG_MAGIC_SYSRQ
  2113		{
  2114			.procname	= "sysrq",
  2115			.data		= NULL,
  2116			.maxlen		= sizeof (int),
  2117			.mode		= 0644,
  2118			.proc_handler	= sysrq_sysctl_handler,
  2119		},
  2120	#endif
  2121	#ifdef CONFIG_PROC_SYSCTL
  2122		{
  2123			.procname	= "cad_pid",
  2124			.data		= NULL,
  2125			.maxlen		= sizeof (int),
  2126			.mode		= 0600,
  2127			.proc_handler	= proc_do_cad_pid,
  2128		},
  2129	#endif
  2130		{
  2131			.procname	= "threads-max",
  2132			.data		= NULL,
  2133			.maxlen		= sizeof(int),
  2134			.mode		= 0644,
  2135			.proc_handler	= sysctl_max_threads,
  2136		},
  2137		{
  2138			.procname	= "random",
  2139			.mode		= 0555,
  2140			.child		= random_table,
  2141		},
  2142		{
  2143			.procname	= "usermodehelper",
  2144			.mode		= 0555,
  2145			.child		= usermodehelper_table,
  2146		},
  2147	#ifdef CONFIG_FW_LOADER_USER_HELPER
  2148		{
  2149			.procname	= "firmware_config",
  2150			.mode		= 0555,
  2151			.child		= firmware_config_table,
  2152		},
  2153	#endif
  2154		{
  2155			.procname	= "overflowuid",
  2156			.data		= &overflowuid,
  2157			.maxlen		= sizeof(int),
  2158			.mode		= 0644,
  2159			.proc_handler	= proc_dointvec_minmax,
  2160			.extra1		= &minolduid,
  2161			.extra2		= &maxolduid,
  2162		},
  2163		{
  2164			.procname	= "overflowgid",
  2165			.data		= &overflowgid,
  2166			.maxlen		= sizeof(int),
  2167			.mode		= 0644,
  2168			.proc_handler	= proc_dointvec_minmax,
  2169			.extra1		= &minolduid,
  2170			.extra2		= &maxolduid,
  2171		},
  2172	#ifdef CONFIG_S390
  2173		{
  2174			.procname	= "userprocess_debug",
  2175			.data		= &show_unhandled_signals,
  2176			.maxlen		= sizeof(int),
  2177			.mode		= 0644,
  2178			.proc_handler	= proc_dointvec,
  2179		},
  2180	#endif
  2181	#ifdef CONFIG_SMP
  2182		{
  2183			.procname	= "oops_all_cpu_backtrace",
  2184			.data		= &sysctl_oops_all_cpu_backtrace,
  2185			.maxlen		= sizeof(int),
  2186			.mode		= 0644,
  2187			.proc_handler	= proc_dointvec_minmax,
  2188			.extra1		= SYSCTL_ZERO,
  2189			.extra2		= SYSCTL_ONE,
  2190		},
  2191	#endif /* CONFIG_SMP */
  2192		{
  2193			.procname	= "pid_max",
  2194			.data		= &pid_max,
  2195			.maxlen		= sizeof (int),
  2196			.mode		= 0644,
  2197			.proc_handler	= proc_dointvec_minmax,
  2198			.extra1		= &pid_max_min,
  2199			.extra2		= &pid_max_max,
  2200		},
  2201		{
  2202			.procname	= "panic_on_oops",
  2203			.data		= &panic_on_oops,
  2204			.maxlen		= sizeof(int),
  2205			.mode		= 0644,
  2206			.proc_handler	= proc_dointvec,
  2207		},
  2208		{
  2209			.procname	= "panic_print",
  2210			.data		= &panic_print,
  2211			.maxlen		= sizeof(unsigned long),
  2212			.mode		= 0644,
  2213			.proc_handler	= proc_doulongvec_minmax,
  2214		},
  2215	#if defined CONFIG_PRINTK
  2216		{
  2217			.procname	= "printk",
  2218			.data		= &console_loglevel,
  2219			.maxlen		= 4*sizeof(int),
  2220			.mode		= 0644,
  2221			.proc_handler	= proc_dointvec,
  2222		},
  2223		{
  2224			.procname	= "printk_ratelimit",
  2225			.data		= &printk_ratelimit_state.interval,
  2226			.maxlen		= sizeof(int),
  2227			.mode		= 0644,
  2228			.proc_handler	= proc_dointvec_jiffies,
  2229		},
  2230		{
  2231			.procname	= "printk_ratelimit_burst",
  2232			.data		= &printk_ratelimit_state.burst,
  2233			.maxlen		= sizeof(int),
  2234			.mode		= 0644,
  2235			.proc_handler	= proc_dointvec,
  2236		},
  2237		{
  2238			.procname	= "printk_delay",
  2239			.data		= &printk_delay_msec,
  2240			.maxlen		= sizeof(int),
  2241			.mode		= 0644,
  2242			.proc_handler	= proc_dointvec_minmax,
  2243			.extra1		= SYSCTL_ZERO,
  2244			.extra2		= &ten_thousand,
  2245		},
  2246		{
  2247			.procname	= "printk_devkmsg",
  2248			.data		= devkmsg_log_str,
  2249			.maxlen		= DEVKMSG_STR_MAX_SIZE,
  2250			.mode		= 0644,
  2251			.proc_handler	= devkmsg_sysctl_set_loglvl,
  2252		},
  2253		{
  2254			.procname	= "dmesg_restrict",
  2255			.data		= &dmesg_restrict,
  2256			.maxlen		= sizeof(int),
  2257			.mode		= 0644,
  2258			.proc_handler	= proc_dointvec_minmax_sysadmin,
  2259			.extra1		= SYSCTL_ZERO,
  2260			.extra2		= SYSCTL_ONE,
  2261		},
  2262		{
  2263			.procname	= "kptr_restrict",
  2264			.data		= &kptr_restrict,
  2265			.maxlen		= sizeof(int),
  2266			.mode		= 0644,
  2267			.proc_handler	= proc_dointvec_minmax_sysadmin,
  2268			.extra1		= SYSCTL_ZERO,
  2269			.extra2		= &two,
  2270		},
  2271	#endif
  2272		{
  2273			.procname	= "ngroups_max",
  2274			.data		= &ngroups_max,
  2275			.maxlen		= sizeof (int),
  2276			.mode		= 0444,
  2277			.proc_handler	= proc_dointvec,
  2278		},
  2279		{
  2280			.procname	= "cap_last_cap",
  2281			.data		= (void *)&cap_last_cap,
  2282			.maxlen		= sizeof(int),
  2283			.mode		= 0444,
  2284			.proc_handler	= proc_dointvec,
  2285		},
  2286	#if defined(CONFIG_LOCKUP_DETECTOR)
  2287		{
  2288			.procname       = "watchdog",
  2289			.data		= &watchdog_user_enabled,
  2290			.maxlen		= sizeof(int),
  2291			.mode		= 0644,
  2292			.proc_handler   = proc_watchdog,
  2293			.extra1		= SYSCTL_ZERO,
  2294			.extra2		= SYSCTL_ONE,
  2295		},
  2296		{
  2297			.procname	= "watchdog_thresh",
  2298			.data		= &watchdog_thresh,
  2299			.maxlen		= sizeof(int),
  2300			.mode		= 0644,
  2301			.proc_handler	= proc_watchdog_thresh,
  2302			.extra1		= SYSCTL_ZERO,
  2303			.extra2		= &sixty,
  2304		},
  2305		{
  2306			.procname       = "nmi_watchdog",
  2307			.data		= &nmi_watchdog_user_enabled,
  2308			.maxlen		= sizeof(int),
  2309			.mode		= NMI_WATCHDOG_SYSCTL_PERM,
  2310			.proc_handler   = proc_nmi_watchdog,
  2311			.extra1		= SYSCTL_ZERO,
  2312			.extra2		= SYSCTL_ONE,
  2313		},
  2314		{
  2315			.procname	= "watchdog_cpumask",
  2316			.data		= &watchdog_cpumask_bits,
  2317			.maxlen		= NR_CPUS,
  2318			.mode		= 0644,
  2319			.proc_handler	= proc_watchdog_cpumask,
  2320		},
  2321	#ifdef CONFIG_SOFTLOCKUP_DETECTOR
  2322		{
  2323			.procname       = "soft_watchdog",
  2324			.data		= &soft_watchdog_user_enabled,
  2325			.maxlen		= sizeof(int),
  2326			.mode		= 0644,
  2327			.proc_handler   = proc_soft_watchdog,
  2328			.extra1		= SYSCTL_ZERO,
  2329			.extra2		= SYSCTL_ONE,
  2330		},
  2331		{
  2332			.procname	= "softlockup_panic",
  2333			.data		= &softlockup_panic,
  2334			.maxlen		= sizeof(int),
  2335			.mode		= 0644,
  2336			.proc_handler	= proc_dointvec_minmax,
  2337			.extra1		= SYSCTL_ZERO,
  2338			.extra2		= SYSCTL_ONE,
  2339		},
  2340	#ifdef CONFIG_SMP
  2341		{
  2342			.procname	= "softlockup_all_cpu_backtrace",
  2343			.data		= &sysctl_softlockup_all_cpu_backtrace,
  2344			.maxlen		= sizeof(int),
  2345			.mode		= 0644,
  2346			.proc_handler	= proc_dointvec_minmax,
  2347			.extra1		= SYSCTL_ZERO,
  2348			.extra2		= SYSCTL_ONE,
  2349		},
  2350	#endif /* CONFIG_SMP */
  2351	#endif
  2352	#ifdef CONFIG_HARDLOCKUP_DETECTOR
  2353		{
  2354			.procname	= "hardlockup_panic",
  2355			.data		= &hardlockup_panic,
  2356			.maxlen		= sizeof(int),
  2357			.mode		= 0644,
  2358			.proc_handler	= proc_dointvec_minmax,
  2359			.extra1		= SYSCTL_ZERO,
  2360			.extra2		= SYSCTL_ONE,
  2361		},
  2362	#ifdef CONFIG_SMP
  2363		{
  2364			.procname	= "hardlockup_all_cpu_backtrace",
  2365			.data		= &sysctl_hardlockup_all_cpu_backtrace,
  2366			.maxlen		= sizeof(int),
  2367			.mode		= 0644,
  2368			.proc_handler	= proc_dointvec_minmax,
  2369			.extra1		= SYSCTL_ZERO,
  2370			.extra2		= SYSCTL_ONE,
  2371		},
  2372	#endif /* CONFIG_SMP */
  2373	#endif
  2374	#endif
  2375	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 39628 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] sched: Add tunable capacity margin for fis_capacity
  2021-06-16 15:05 ` YT Chang
  (?)
@ 2021-06-18 17:14   ` Qais Yousef
  -1 siblings, 0 replies; 10+ messages in thread
From: Qais Yousef @ 2021-06-18 17:14 UTC (permalink / raw)
  To: YT Chang
  Cc: Rafael J. Wysocki, Viresh Kumar, Luis Chamberlain, Kees Cook,
	Iurii Zaikin, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Matthias Brugger,
	Paul Turner, Greg Kroah-Hartman, linux-pm, linux-kernel,
	linux-fsdevel, linux-arm-kernel, linux-mediatek, wsd_upstream

Hi YT Chang

Thanks for the patch.

On 06/16/21 23:05, YT Chang wrote:
> Currently, the margin of cpu frequency raising and cpu overutilized are
> hard-coded as 25% (1280/1024). Make the margin tunable

The way I see cpu overutilized is that we check if we're above the 80% range.

> to control the aggressive for placement and frequency control. Such as
> for power tuning framework could adjust smaller margin to slow down
> frequency raising speed and let task stay in smaller cpu.
> 
> For light loading scenarios, like beach buggy blitz and messaging apps,
> the app threads are moved big core with 25% margin and causing
> unnecessary power.
> With 0% capacity margin (1024/1024), the app threads could be kept in
> little core and deliver better power results without any fps drop.
> 
> capacity margin        0%          10%          20%          30%
>                      current        current       current      current
>                   Fps  (mA)    Fps    (mA)   Fps   (mA)    Fps  (mA)
> Beach buggy blitz  60 198.164  60   203.211  60   209.984  60  213.374
> Yahoo browser      60 232.301 59.97 237.52  59.95 248.213  60  262.809
> 
> Change-Id: Iba48c556ed1b73c9a2699e9e809bc7d9333dc004
> Signed-off-by: YT Chang <yt.chang@mediatek.com>
> ---

We are aware of the cpu overutilized value not being adequate on some modern
platforms. But I haven't considered or seen any issues with the frequency one.
So the latter is an interesting one.

I like your patch, but sadly I can't agree with it too.

The dilemma is that there are several options forward based on what we've seen
vendors do/want:

	1. Modify the margin to be small for high end SoC and larger for lower
	   end ones. Which is what your patch allows.
	2. Some vendors have a per cluster (perf domain) value. So within the
	   same SoC different margins are used for each capacity level.
	3. Some vendors have asymmetric margin. A margin to move up and a
	   different margin to go down.

We're still not sure which approach is the best way forward.

Your patch allows 1, but if it turned out options 2 or 3 are better; the ABI
will make it hard to change.

Have you considered all these options? Do you have any data to help support
1 is enough for the range of platforms you work with at least?

We were considering also whether we can have a smarter logic to automagically
set a better value for the platform, but no concrete suggestions yet.

So while I agree the current margin value of one size fits all is no longer
suitable. But the variation of hardware and the possible approaches we could
take need more careful thinking and consideration before committing to an ABI.

This patch is a good start for this discussion :)


Thanks

--
Qais Yousef

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] sched: Add tunable capacity margin for fis_capacity
@ 2021-06-18 17:14   ` Qais Yousef
  0 siblings, 0 replies; 10+ messages in thread
From: Qais Yousef @ 2021-06-18 17:14 UTC (permalink / raw)
  To: YT Chang
  Cc: Rafael J. Wysocki, Viresh Kumar, Luis Chamberlain, Kees Cook,
	Iurii Zaikin, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Matthias Brugger,
	Paul Turner, Greg Kroah-Hartman, linux-pm, linux-kernel,
	linux-fsdevel, linux-arm-kernel, linux-mediatek, wsd_upstream

Hi YT Chang

Thanks for the patch.

On 06/16/21 23:05, YT Chang wrote:
> Currently, the margin of cpu frequency raising and cpu overutilized are
> hard-coded as 25% (1280/1024). Make the margin tunable

The way I see cpu overutilized is that we check if we're above the 80% range.

> to control the aggressive for placement and frequency control. Such as
> for power tuning framework could adjust smaller margin to slow down
> frequency raising speed and let task stay in smaller cpu.
> 
> For light loading scenarios, like beach buggy blitz and messaging apps,
> the app threads are moved big core with 25% margin and causing
> unnecessary power.
> With 0% capacity margin (1024/1024), the app threads could be kept in
> little core and deliver better power results without any fps drop.
> 
> capacity margin        0%          10%          20%          30%
>                      current        current       current      current
>                   Fps  (mA)    Fps    (mA)   Fps   (mA)    Fps  (mA)
> Beach buggy blitz  60 198.164  60   203.211  60   209.984  60  213.374
> Yahoo browser      60 232.301 59.97 237.52  59.95 248.213  60  262.809
> 
> Change-Id: Iba48c556ed1b73c9a2699e9e809bc7d9333dc004
> Signed-off-by: YT Chang <yt.chang@mediatek.com>
> ---

We are aware of the cpu overutilized value not being adequate on some modern
platforms. But I haven't considered or seen any issues with the frequency one.
So the latter is an interesting one.

I like your patch, but sadly I can't agree with it too.

The dilemma is that there are several options forward based on what we've seen
vendors do/want:

	1. Modify the margin to be small for high end SoC and larger for lower
	   end ones. Which is what your patch allows.
	2. Some vendors have a per cluster (perf domain) value. So within the
	   same SoC different margins are used for each capacity level.
	3. Some vendors have asymmetric margin. A margin to move up and a
	   different margin to go down.

We're still not sure which approach is the best way forward.

Your patch allows 1, but if it turned out options 2 or 3 are better; the ABI
will make it hard to change.

Have you considered all these options? Do you have any data to help support
1 is enough for the range of platforms you work with at least?

We were considering also whether we can have a smarter logic to automagically
set a better value for the platform, but no concrete suggestions yet.

So while I agree the current margin value of one size fits all is no longer
suitable. But the variation of hardware and the possible approaches we could
take need more careful thinking and consideration before committing to an ABI.

This patch is a good start for this discussion :)


Thanks

--
Qais Yousef

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] sched: Add tunable capacity margin for fis_capacity
@ 2021-06-18 17:14   ` Qais Yousef
  0 siblings, 0 replies; 10+ messages in thread
From: Qais Yousef @ 2021-06-18 17:14 UTC (permalink / raw)
  To: YT Chang
  Cc: Rafael J. Wysocki, Viresh Kumar, Luis Chamberlain, Kees Cook,
	Iurii Zaikin, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Matthias Brugger,
	Paul Turner, Greg Kroah-Hartman, linux-pm, linux-kernel,
	linux-fsdevel, linux-arm-kernel, linux-mediatek, wsd_upstream

Hi YT Chang

Thanks for the patch.

On 06/16/21 23:05, YT Chang wrote:
> Currently, the margin of cpu frequency raising and cpu overutilized are
> hard-coded as 25% (1280/1024). Make the margin tunable

The way I see cpu overutilized is that we check if we're above the 80% range.

> to control the aggressive for placement and frequency control. Such as
> for power tuning framework could adjust smaller margin to slow down
> frequency raising speed and let task stay in smaller cpu.
> 
> For light loading scenarios, like beach buggy blitz and messaging apps,
> the app threads are moved big core with 25% margin and causing
> unnecessary power.
> With 0% capacity margin (1024/1024), the app threads could be kept in
> little core and deliver better power results without any fps drop.
> 
> capacity margin        0%          10%          20%          30%
>                      current        current       current      current
>                   Fps  (mA)    Fps    (mA)   Fps   (mA)    Fps  (mA)
> Beach buggy blitz  60 198.164  60   203.211  60   209.984  60  213.374
> Yahoo browser      60 232.301 59.97 237.52  59.95 248.213  60  262.809
> 
> Change-Id: Iba48c556ed1b73c9a2699e9e809bc7d9333dc004
> Signed-off-by: YT Chang <yt.chang@mediatek.com>
> ---

We are aware of the cpu overutilized value not being adequate on some modern
platforms. But I haven't considered or seen any issues with the frequency one.
So the latter is an interesting one.

I like your patch, but sadly I can't agree with it too.

The dilemma is that there are several options forward based on what we've seen
vendors do/want:

	1. Modify the margin to be small for high end SoC and larger for lower
	   end ones. Which is what your patch allows.
	2. Some vendors have a per cluster (perf domain) value. So within the
	   same SoC different margins are used for each capacity level.
	3. Some vendors have asymmetric margin. A margin to move up and a
	   different margin to go down.

We're still not sure which approach is the best way forward.

Your patch allows 1, but if it turned out options 2 or 3 are better; the ABI
will make it hard to change.

Have you considered all these options? Do you have any data to help support
1 is enough for the range of platforms you work with at least?

We were considering also whether we can have a smarter logic to automagically
set a better value for the platform, but no concrete suggestions yet.

So while I agree the current margin value of one size fits all is no longer
suitable. But the variation of hardware and the possible approaches we could
take need more careful thinking and consideration before committing to an ABI.

This patch is a good start for this discussion :)


Thanks

--
Qais Yousef

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-06-18 17:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-16 15:05 [PATCH 1/1] sched: Add tunable capacity margin for fis_capacity YT Chang
2021-06-16 15:05 ` YT Chang
2021-06-16 15:05 ` YT Chang
2021-06-16 15:22 ` Vincent Guittot
2021-06-16 15:22   ` Vincent Guittot
2021-06-16 15:22   ` Vincent Guittot
2021-06-17 17:56 ` kernel test robot
2021-06-18 17:14 ` Qais Yousef
2021-06-18 17:14   ` Qais Yousef
2021-06-18 17:14   ` Qais Yousef

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.