diff options
Diffstat (limited to 'cacule-32bit-converter.patch')
-rw-r--r-- | cacule-32bit-converter.patch | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/cacule-32bit-converter.patch b/cacule-32bit-converter.patch index 1526fa083bc4..ac277f113762 100644 --- a/cacule-32bit-converter.patch +++ b/cacule-32bit-converter.patch @@ -5,14 +5,14 @@ index c99fc326ec24..71c27133c53c 100644 @@ -26,6 +26,8 @@ */ #include "sched.h" - + +#include <linux/math64.h> + /* * Targeted preemption latency for CPU-bound tasks: * @@ -127,7 +129,7 @@ int __weak arch_asym_cpu_priority(int cpu) - + #endif #ifdef CONFIG_CACULE_SCHED -unsigned int __read_mostly cacule_max_lifetime = 22000; // in ms @@ -25,12 +25,12 @@ index c99fc326ec24..71c27133c53c 100644 u64 l_se, vr_se, sleep_se = 1ULL, u64_factor_m, _2m; unsigned int score_se, fake_interactivity; + u32 r_se_rem; - + /* * in case of vruntime==0, logical OR with 1 would @@ -616,9 +619,19 @@ calc_interactivity(u64 now, struct cacule_node *se) sleep_se = (l_se - vr_se) | 1; - + if (sleep_se >= vr_se) - score_se = u64_factor_m / (sleep_se / vr_se); + score_se = div_u64_rem @@ -47,7 +47,7 @@ index c99fc326ec24..71c27133c53c 100644 + div_u64_rem(vr_se, sleep_se, &r_se_rem) + ), &r_se_rem) + ); - + fake_interactivity = is_fake_interactive(se); if (fake_interactivity) @@ -1041,6 +1054,7 @@ static void normalize_lifetime(u64 now, struct sched_entity *se) @@ -55,24 +55,24 @@ index c99fc326ec24..71c27133c53c 100644 u64 max_life_ns, life_time; s64 diff; + u32 rem; - + /* * left shift 20 bits is approximately = * 1000000 @@ -1054,9 +1068,9 @@ static void normalize_lifetime(u64 now, struct sched_entity *se) life_time = now - cn->cacule_start_time; diff = life_time - max_life_ns; - + - if (diff > 0) { + if (diff > 0) { // multiply life_time by 1024 for more precision - u64 old_hrrn_x = (life_time << 7) / ((cn->vruntime >> 3) | 1); + u64 old_hrrn_x8 = div_u64_rem(life_time, ((cn->vruntime >> 3) | 1), &rem); - + // reset life to half max_life (i.e ~15s) cn->cacule_start_time = now - (max_life_ns >> 1); @@ -1065,7 +1079,7 @@ static void reset_lifetime(u64 now, struct sched_entity *se) if (old_hrrn_x8 == 0) old_hrrn_x8 = 1; - + // reset vruntime based on old hrrn ratio - cn->vruntime = (max_life_ns << 9) / old_hrrn_x; + cn->vruntime = div_u64_rem((max_life_ns << 2), old_hrrn_x8, &rem); |