From 0abd7ac721c8711f8fb9ecc26b36fdc735cc6701 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 [kdrag0n: Regenerated for android-4.19] Signed-off-by: Danny Lin --- Documentation/scheduler/sched-pelt.c | 25 +++++---- kernel/sched/sched-pelt.h | 80 +++++++++------------------- 2 files changed, 41 insertions(+), 64 deletions(-) diff --git a/Documentation/scheduler/sched-pelt.c b/Documentation/scheduler/sched-pelt.c index 21603bb46c5e..569e4ea1ab16 100644 --- a/Documentation/scheduler/sched-pelt.c +++ b/Documentation/scheduler/sched-pelt.c @@ -26,12 +26,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) { @@ -52,9 +52,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) { @@ -102,18 +101,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 0bf2939c5355..78598c5e17fe 100644 --- a/kernel/sched/sched-pelt.h +++ b/kernel/sched/sched-pelt.h @@ -1,15 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* Generated by Documentation/scheduler/sched-pelt; do not modify. */ -#if CONFIG_PELT_UTIL_HALFLIFE_32 +#ifdef CONFIG_PELT_UTIL_HALFLIFE_32 static const u32 runnable_avg_yN_inv[] __maybe_unused = { - 0xffffffff, 0xfa83b2da, 0xf5257d14, 0xefe4b99a, - 0xeac0c6e6, 0xe5b906e6, 0xe0ccdeeb, 0xdbfbb796, - 0xd744fcc9, 0xd2a81d91, 0xce248c14, 0xc9b9bd85, - 0xc5672a10, 0xc12c4cc9, 0xbd08a39e, 0xb8fbaf46, - 0xb504f333, 0xb123f581, 0xad583ee9, 0xa9a15ab4, - 0xa5fed6a9, 0xa2704302, 0x9ef5325f, 0x9b8d39b9, - 0x9837f050, 0x94f4efa8, 0x91c3d373, 0x8ea4398a, - 0x8b95c1e3, 0x88980e80, 0x85aac367, 0x82cd8698, + 0xffffffff,0xfa83b2da,0xf5257d14,0xefe4b99a, + 0xeac0c6e6,0xe5b906e6,0xe0ccdeeb,0xdbfbb796, + 0xd744fcc9,0xd2a81d91,0xce248c14,0xc9b9bd85, + 0xc5672a10,0xc12c4cc9,0xbd08a39e,0xb8fbaf46, + 0xb504f333,0xb123f581,0xad583ee9,0xa9a15ab4, + 0xa5fed6a9,0xa2704302,0x9ef5325f,0x9b8d39b9, + 0x9837f050,0x94f4efa8,0x91c3d373,0x8ea4398a, + 0x8b95c1e3,0x88980e80,0x85aac367,0x82cd8698, }; static const u32 runnable_avg_yN_sum[] = { @@ -22,70 +23,39 @@ static const u32 runnable_avg_yN_sum[] = { #define LOAD_AVG_MAX 47742 #define LOAD_AVG_MAX_N 345 -static const u32 __accumulated_sum_N32[] = { - 0, 23371, 35056, 40899, 43820, 45281, - 46011, 46376, 46559, 46650, 46696, 46719, -}; - #endif -#if CONFIG_PELT_UTIL_HALFLIFE_16 +#ifdef CONFIG_PELT_UTIL_HALFLIFE_16 static const u32 runnable_avg_yN_inv[] __maybe_unused = { - 0xffffffff, 0xf5257d14, 0xeac0c6e6, 0xe0ccdeeb, - 0xd744fcc9, 0xce248c14, 0xc5672a10, 0xbd08a39e, - 0xb504f333, 0xad583ee9, 0xa5fed6a9, 0x9ef5325f, - 0x9837f050, 0x91c3d373, 0x8b95c1e3, 0x85aac367, + 0xffffffff,0xf5257d14,0xeac0c6e6,0xe0ccdeeb, + 0xd744fcc9,0xce248c14,0xc5672a10,0xbd08a39e, + 0xb504f333,0xad583ee9,0xa5fed6a9,0x9ef5325f, + 0x9837f050,0x91c3d373,0x8b95c1e3,0x85aac367, }; 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 - -static const u32 __accumulated_sum_N32[] = { - 0, 22731, 34096, 39779, 42620, 44041, - 44751, 45106, 45284, 45373, 45417, 45439, - 45450, 45456, 45459, 45460, 45461, 45461, - 45461, 45461, 45461, 45461, 45461, 45461, - 45461, 45461, 45461, 45461, 45461, 45461, - 45461, 45461, 45461, 45461, -}; +#define LOAD_AVG_MAX 24130 +#define LOAD_AVG_MAX_N 172 #endif -#if CONFIG_PELT_UTIL_HALFLIFE_8 +#ifdef CONFIG_PELT_UTIL_HALFLIFE_8 static const u32 runnable_avg_yN_inv[] __maybe_unused = { - 0xffffffff, 0xeac0c6e6, 0xd744fcc9, 0xc5672a10, - 0xb504f333, 0xa5fed6a9, 0x9837f050, 0x8b95c1e3, + 0xffffffff,0xeac0c6e6,0xd744fcc9,0xc5672a10, + 0xb504f333,0xa5fed6a9,0x9837f050,0x8b95c1e3, }; 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 - -static const u32 __accumulated_sum_N32[] = { - 0, 16507, 24760, 28887, 30950, 31982, - 32498, 32756, 32885, 32949, 32981, 32997, - 33005, 33009, 33011, 33012, 33013, 33013, - 33013, 33013, 33013, 33013, 33013, 33013, - 33013, 33013, 33013, 33013, 33013, 33013, - 33013, 33013, 33013, 33013, 33013, 33013, - 33013, 33013, 33013, 33013, 33013, 33013, - 33013, 33013, 33013, 33013, 33013, 33013, - 33013, 33013, 33013, 33013, 33013, 33013, - 33013, 33013, 33013, 33013, 33013, 33013, - 33013, 33013, 33013, 33013, 33013, 33013, - 33013, 33013, 33013, 33013, 33013, 33013, - 33013, 33013, 33013, 33013, 33013, -}; +#define LOAD_AVG_MAX 12326 +#define LOAD_AVG_MAX_N 85 #endif -