From 3c207c880674e5d29aa1c9b7e94d812383c442ee Mon Sep 17 00:00:00 2001 From: Guanglei Li Date: Mon, 17 Dec 2018 18:57:32 +0800 Subject: [PATCH] ANDROID: sched/fair: correct pelt load information in sched-pelt.h With the following commit: cb22d9159761 ("sched/fair: add support to tune PELT ramp/decay timings) PELT introduced 16ms/8ms for load/utilization half-life decayed. Precomputed load information inclued in sched-pelt.h is generated by Documentation/scheduler/sched-pelt.c. With this commit, runnable_avg_yN_sum[]/LOAD_AVG_MAX/LOAD_AVG_MAX_N is precomputed wrong for 16ms/8ms half-life. Bug: 120440300 Change-Id: I83d90963b714449ec8036423ce8bc25f0b4cd6b9 Signed-off-by: Guanglei Li Signed-off-by: Ke Wang --- Documentation/scheduler/sched-pelt.c | 25 ++++++++++++++++--------- kernel/sched/sched-pelt.h | 15 +++++++-------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/Documentation/scheduler/sched-pelt.c b/Documentation/scheduler/sched-pelt.c index cd3e1fe7a98a..20ebf049aa09 100644 --- a/Documentation/scheduler/sched-pelt.c +++ b/Documentation/scheduler/sched-pelt.c @@ -25,12 +25,12 @@ void calc_runnable_avg_yN_inv(const int halflife) x = ((1UL<<32)-1)*pow(y, i); if (i % 4 == 0) printf("\n\t"); - printf("0x%8x, ", x); + printf("0x%8x,", x); } printf("\n};\n\n"); } -int sum = 1024; +int sum; void calc_runnable_avg_yN_sum(const int halflife) { @@ -51,9 +51,8 @@ void calc_runnable_avg_yN_sum(const int halflife) printf("\n};\n\n"); } -int n = -1; -/* first period */ -long max = 1024; +int n; +long max; void calc_converged_max(const int halflife) { @@ -101,18 +100,26 @@ void main(void) int hl_count = sizeof(hl_value) / sizeof(int); int hl_idx, halflife; - printf("/* Generated by Documentation/scheduler/sched-pelt; do not modify. */\n\n"); + printf("/* SPDX-License-Identifier: GPL-2.0 */\n"); + printf("/* Generated by Documentation/scheduler/sched-pelt; do not modify. */\n"); for (hl_idx = 0; hl_idx < hl_count; ++hl_idx) { halflife = hl_value[hl_idx]; y = pow(0.5, 1/(double)halflife); + sum = 1024; + /* first period */ + max = 1024; + n = -1; - printf("#if CONFIG_PELT_UTIL_HALFLIFE_%d\n", halflife); + printf("\n#ifdef CONFIG_PELT_UTIL_HALFLIFE_%d\n", halflife); calc_runnable_avg_yN_inv(halflife); calc_runnable_avg_yN_sum(halflife); calc_converged_max(halflife); - calc_accumulated_sum_32(halflife); - printf("#endif\n\n"); + /* + * calc_accumulated_sum_32(halflife) precomputed load sum table of half-life, + * not used yet. + */ + printf("#endif\n"); } } diff --git a/kernel/sched/sched-pelt.h b/kernel/sched/sched-pelt.h index ac7d489be8ce..df89df6d7595 100644 --- a/kernel/sched/sched-pelt.h +++ b/kernel/sched/sched-pelt.h @@ -1,7 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* Generated by Documentation/scheduler/sched-pelt; do not modify. */ - #ifdef CONFIG_PELT_UTIL_HALFLIFE_32 static const u32 runnable_avg_yN_inv[] = { 0xffffffff,0xfa83b2da,0xf5257d14,0xefe4b99a, @@ -35,13 +34,13 @@ static const u32 runnable_avg_yN_inv[] = { }; static const u32 runnable_avg_yN_sum[] = { - 0,22380,22411,22441,22470,22497,22523,22548,22572,22595,22617, - 22638,22658,22677,22696,22714,22731, + 0, 980, 1919, 2818, 3679, 4503, 5292, 6048, 6772, 7465, 8129, + 8764, 9373, 9956,10514,11048,11560, }; #define LOAD_AVG_PERIOD 16 -#define LOAD_AVG_MAX 24152 -#define LOAD_AVG_MAX_N 517 +#define LOAD_AVG_MAX 24130 +#define LOAD_AVG_MAX_N 172 #endif @@ -52,11 +51,11 @@ static const u32 runnable_avg_yN_inv[] = { }; static const u32 runnable_avg_yN_sum[] = { - 0,20844,20053,19327,18661,18051,17491,16978,16507, + 0, 939, 1800, 2589, 3313, 3977, 4585, 5143, 5655, }; #define LOAD_AVG_PERIOD 8 -#define LOAD_AVG_MAX 12337 -#define LOAD_AVG_MAX_N 603 +#define LOAD_AVG_MAX 12326 +#define LOAD_AVG_MAX_N 85 #endif -- 2.20.1