diff --git a/patches/0003-bore-cachy-ext.patch b/patches/0003-bore-cachy-ext.patch index e76e5a0..17eedcf 100644 --- a/patches/0003-bore-cachy-ext.patch +++ b/patches/0003-bore-cachy-ext.patch @@ -1,31 +1,46 @@ -From 92130ba595a1a57cb0cf5c806be12bc3c0d315c3 Mon Sep 17 00:00:00 2001 -From: Piotr Gorski -Date: Wed, 25 Sep 2024 08:07:10 +0200 +From 02401e1df25c88de792f9f7261ac827e488e607b Mon Sep 17 00:00:00 2001 +From: Eric Naim +Date: Fri, 4 Oct 2024 14:55:16 +0800 Subject: [PATCH] bore-cachy-ext -Signed-off-by: Piotr Gorski +Signed-off-by: Eric Naim --- - include/linux/sched.h | 15 +- - include/linux/sched/bore.h | 38 ++++ + include/linux/sched.h | 20 +- + include/linux/sched/bore.h | 37 ++++ init/Kconfig | 17 ++ - kernel/Kconfig.hz | 16 ++ + kernel/Kconfig.hz | 17 ++ kernel/fork.c | 5 + kernel/sched/Makefile | 1 + - kernel/sched/bore.c | 413 +++++++++++++++++++++++++++++++++++++ + kernel/sched/bore.c | 380 +++++++++++++++++++++++++++++++++++++ kernel/sched/core.c | 7 + kernel/sched/debug.c | 60 +++++- - kernel/sched/fair.c | 99 +++++++-- + kernel/sched/fair.c | 102 ++++++++-- kernel/sched/features.h | 4 + kernel/sched/sched.h | 7 + - 12 files changed, 664 insertions(+), 18 deletions(-) + 12 files changed, 639 insertions(+), 18 deletions(-) create mode 100644 include/linux/sched/bore.h create mode 100644 kernel/sched/bore.c diff --git a/include/linux/sched.h b/include/linux/sched.h -index 5b4f78fe3..7912524df 100644 +index 5b4f78fe379d..bb4567e29671 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h -@@ -545,12 +545,25 @@ struct sched_entity { +@@ -537,6 +537,14 @@ struct sched_statistics { + #endif /* CONFIG_SCHEDSTATS */ + } ____cacheline_aligned; + ++#ifdef CONFIG_SCHED_BORE ++struct sched_burst_cache { ++ u8 score; ++ u32 count; ++ u64 timestamp; ++}; ++#endif // CONFIG_SCHED_BORE ++ + struct sched_entity { + /* For load-balancing: */ + struct load_weight load; +@@ -545,12 +553,22 @@ struct sched_entity { u64 min_vruntime; struct list_head group_node; @@ -43,21 +58,18 @@ index 5b4f78fe3..7912524df 100644 + u8 curr_burst_penalty; + u8 burst_penalty; + u8 burst_score; -+ u8 child_burst; -+ u8 tg_burst; -+ u32 child_burst_cnt; -+ u64 child_burst_last_cached; -+ u64 tg_burst_last_cached; ++ struct sched_burst_cache child_burst; ++ struct sched_burst_cache group_burst; +#endif // CONFIG_SCHED_BORE s64 vlag; u64 slice; diff --git a/include/linux/sched/bore.h b/include/linux/sched/bore.h new file mode 100644 -index 000000000..26abf8cfc +index 000000000000..12a613a94ff0 --- /dev/null +++ b/include/linux/sched/bore.h -@@ -0,0 +1,38 @@ +@@ -0,0 +1,37 @@ + +#include +#include @@ -70,8 +82,7 @@ index 000000000..26abf8cfc +extern u8 __read_mostly sched_burst_exclude_kthreads; +extern u8 __read_mostly sched_burst_smoothness_long; +extern u8 __read_mostly sched_burst_smoothness_short; -+extern u8 __read_mostly sched_burst_atavistic_mask; -+extern u8 __read_mostly sched_burst_atavistic_depth; ++extern u8 __read_mostly sched_burst_fork_atavistic; +extern u8 __read_mostly sched_burst_parity_threshold; +extern u8 __read_mostly sched_burst_penalty_offset; +extern uint __read_mostly sched_burst_penalty_scale; @@ -97,7 +108,7 @@ index 000000000..26abf8cfc +#endif // CONFIG_SCHED_BORE +#endif // _LINUX_SCHED_BORE_H diff --git a/init/Kconfig b/init/Kconfig -index e1a88d48d..3aea8e43c 100644 +index e1a88d48d652..3aea8e43c360 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1327,6 +1327,23 @@ config CHECKPOINT_RESTORE @@ -125,10 +136,10 @@ index e1a88d48d..3aea8e43c 100644 bool "Automatic process group scheduling" select CGROUPS diff --git a/kernel/Kconfig.hz b/kernel/Kconfig.hz -index 0f78364ef..b50189ee5 100644 +index 0f78364efd4f..83a6b919ab29 100644 --- a/kernel/Kconfig.hz +++ b/kernel/Kconfig.hz -@@ -79,5 +79,21 @@ config HZ +@@ -79,5 +79,22 @@ config HZ default 750 if HZ_750 default 1000 if HZ_1000 @@ -139,7 +150,8 @@ index 0f78364ef..b50189ee5 100644 + The BORE Scheduler automatically calculates the optimal base + slice for the configured HZ using the following equation: + -+ base_slice_ns = max(min_base_slice_ns, 1000000000/HZ) ++ base_slice_ns = ++ 1000000000/HZ * DIV_ROUNDUP(min_base_slice_ns, 1000000000/HZ) + + This option sets the default lower bound limit of the base slice + to prevent the loss of task throughput due to overscheduling. @@ -151,7 +163,7 @@ index 0f78364ef..b50189ee5 100644 config SCHED_HRTICK def_bool HIGH_RES_TIMERS diff --git a/kernel/fork.c b/kernel/fork.c -index 69a0a7210..68737ef70 100644 +index 69a0a7210060..68737ef70d5c 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -116,6 +116,8 @@ @@ -174,7 +186,7 @@ index 69a0a7210..68737ef70 100644 retval = perf_event_init_task(p, clone_flags); if (retval) diff --git a/kernel/sched/Makefile b/kernel/sched/Makefile -index 976092b7b..293aad675 100644 +index 976092b7bd45..293aad675444 100644 --- a/kernel/sched/Makefile +++ b/kernel/sched/Makefile @@ -32,3 +32,4 @@ obj-y += core.o @@ -184,10 +196,10 @@ index 976092b7b..293aad675 100644 +obj-y += bore.o diff --git a/kernel/sched/bore.c b/kernel/sched/bore.c new file mode 100644 -index 000000000..f2b1f1179 +index 000000000000..62a0191a32d7 --- /dev/null +++ b/kernel/sched/bore.c -@@ -0,0 +1,413 @@ +@@ -0,0 +1,380 @@ +/* + * Burst-Oriented Response Enhancer (BORE) CPU Scheduler + * Copyright (C) 2021-2024 Masahito Suzuki @@ -201,10 +213,9 @@ index 000000000..f2b1f1179 +u8 __read_mostly sched_burst_exclude_kthreads = 1; +u8 __read_mostly sched_burst_smoothness_long = 1; +u8 __read_mostly sched_burst_smoothness_short = 0; -+u8 __read_mostly sched_burst_atavistic_mask = 0x2; -+u8 __read_mostly sched_burst_atavistic_depth = 2; ++u8 __read_mostly sched_burst_fork_atavistic = 2; +u8 __read_mostly sched_burst_parity_threshold = 2; -+u8 __read_mostly sched_burst_penalty_offset = 22; ++u8 __read_mostly sched_burst_penalty_offset = 24; +uint __read_mostly sched_burst_penalty_scale = 1280; +uint __read_mostly sched_burst_cache_lifetime = 60000000; +uint __read_mostly sched_deadline_boost_mask = ENQUEUE_INITIAL @@ -216,9 +227,9 @@ index 000000000..f2b1f1179 +#define MAX_BURST_PENALTY (39U <<2) + +static inline u32 log2plus1_u64_u32f8(u64 v) { -+ u32 msb = fls64(v); -+ u8 fractional = (v << (64 - msb) >> 55); -+ return msb << 8 | fractional; ++ u32 integral = fls64(v); ++ u8 fractional = v << (64 - integral) >> 55; ++ return integral << 8 | fractional; +} + +static inline u32 calc_burst_penalty(u64 burst_time) { @@ -232,13 +243,11 @@ index 000000000..f2b1f1179 + return min(MAX_BURST_PENALTY, scaled_penalty); +} + -+static inline u64 __scale_slice(u64 delta, u8 score) { -+ return mul_u64_u32_shr(delta, sched_prio_to_wmult[score], 22); -+} ++static inline u64 __scale_slice(u64 delta, u8 score) ++{return mul_u64_u32_shr(delta, sched_prio_to_wmult[score], 22);} + -+static inline u64 __unscale_slice(u64 delta, u8 score) { -+ return mul_u64_u32_shr(delta, sched_prio_to_weight[score], 10); -+} ++static inline u64 __unscale_slice(u64 delta, u8 score) ++{return mul_u64_u32_shr(delta, sched_prio_to_weight[score], 10);} + +static void reweight_task_by_prio(struct task_struct *p, int prio) { + struct sched_entity *se = &p->se; @@ -283,7 +292,7 @@ index 000000000..f2b1f1179 + old - (-increment >> (int)sched_burst_smoothness_short); +} + -+static void __revolve_burst_penalty(struct sched_entity *se) { ++static void revolve_burst_penalty(struct sched_entity *se) { + se->prev_burst_penalty = + binary_smooth(se->curr_burst_penalty, se->prev_burst_penalty); + se->burst_time = 0; @@ -291,7 +300,7 @@ index 000000000..f2b1f1179 +} + +inline void restart_burst(struct sched_entity *se) { -+ __revolve_burst_penalty(se); ++ revolve_burst_penalty(se); + se->burst_penalty = se->prev_burst_penalty; + update_burst_score(se); +} @@ -344,22 +353,18 @@ index 000000000..f2b1f1179 + return cnt; +} + -+static inline bool task_burst_inheritable(struct task_struct *p) { -+ return (p->sched_class == &fair_sched_class); -+} ++static inline bool task_is_bore_eligible(struct task_struct *p) ++{return p->sched_class == &fair_sched_class;} + -+static inline bool child_burst_cache_expired(struct task_struct *p, u64 now) { -+ u64 expiration_time = -+ p->se.child_burst_last_cached + sched_burst_cache_lifetime; -+ return ((s64)(expiration_time - now) < 0); -+} ++static inline bool burst_cache_expired(struct sched_burst_cache *bc, u64 now) ++{return (s64)(bc->timestamp + sched_burst_cache_lifetime - now) < 0;} + -+static void __update_child_burst_cache( ++static void update_burst_cache(struct sched_burst_cache *bc, + struct task_struct *p, u32 cnt, u32 sum, u64 now) { + u8 avg = cnt ? sum / cnt : 0; -+ p->se.child_burst = max(avg, p->se.burst_penalty); -+ p->se.child_burst_cnt = cnt; -+ p->se.child_burst_last_cached = now; ++ bc->score = max(avg, p->se.burst_penalty); ++ bc->count = cnt; ++ bc->timestamp = now; +} + +static inline void update_child_burst_direct(struct task_struct *p, u64 now) { @@ -367,20 +372,20 @@ index 000000000..f2b1f1179 + struct task_struct *child; + + list_for_each_entry(child, &p->children, sibling) { -+ if (!task_burst_inheritable(child)) continue; ++ if (!task_is_bore_eligible(child)) continue; + cnt++; + sum += child->se.burst_penalty; + } + -+ __update_child_burst_cache(p, cnt, sum, now); ++ update_burst_cache(&p->se.child_burst, p, cnt, sum, now); +} + -+static inline u8 __inherit_burst_direct(struct task_struct *p, u64 now) { ++static inline u8 inherit_burst_direct(struct task_struct *p, u64 now) { + struct task_struct *parent = p; -+ if (child_burst_cache_expired(parent, now)) ++ if (burst_cache_expired(&parent->se.child_burst, now)) + update_child_burst_direct(parent, now); + -+ return parent->se.child_burst; ++ return parent->se.child_burst.score; +} + +static void update_child_burst_topological( @@ -394,49 +399,36 @@ index 000000000..f2b1f1179 + dec = list_first_entry(&dec->children, struct task_struct, sibling); + + if (!dcnt || !depth) { -+ if (!task_burst_inheritable(dec)) continue; ++ if (!task_is_bore_eligible(dec)) continue; + cnt++; + sum += dec->se.burst_penalty; + continue; + } -+ if (!child_burst_cache_expired(dec, now)) { -+ cnt += dec->se.child_burst_cnt; -+ sum += (u32)dec->se.child_burst * dec->se.child_burst_cnt; ++ if (!burst_cache_expired(&dec->se.child_burst, now)) { ++ cnt += dec->se.child_burst.count; ++ sum += (u32)dec->se.child_burst.score * dec->se.child_burst.count; + continue; + } + update_child_burst_topological(dec, now, depth - 1, &cnt, &sum); + } + -+ __update_child_burst_cache(p, cnt, sum, now); ++ update_burst_cache(&p->se.child_burst, p, cnt, sum, now); + *acnt += cnt; + *asum += sum; +} + -+static inline u8 __inherit_burst_topological(struct task_struct *p, u64 now) { ++static inline u8 inherit_burst_topological(struct task_struct *p, u64 now) { + struct task_struct *anc = p; + u32 cnt = 0, sum = 0; + + while (anc->real_parent != anc && count_child_tasks(anc) == 1) + anc = anc->real_parent; + -+ if (child_burst_cache_expired(anc, now)) ++ if (burst_cache_expired(&anc->se.child_burst, now)) + update_child_burst_topological( -+ anc, now, sched_burst_atavistic_depth - 1, &cnt, &sum); ++ anc, now, sched_burst_fork_atavistic - 1, &cnt, &sum); + -+ return anc->se.child_burst; -+} -+ -+static inline bool tg_burst_cache_expired(struct task_struct *p, u64 now) { -+ u64 expiration_time = -+ p->se.tg_burst_last_cached + sched_burst_cache_lifetime; -+ return ((s64)(expiration_time - now) < 0); -+} -+ -+static void __update_tg_burst_cache( -+ struct task_struct *p, u32 cnt, u32 sum, u64 now) { -+ u8 avg = cnt ? sum / cnt : 0; -+ p->se.tg_burst = max(avg, p->se.burst_penalty); -+ p->se.tg_burst_last_cached = now; ++ return anc->se.child_burst.score; +} + +static inline void update_tg_burst(struct task_struct *p, u64 now) { @@ -444,45 +436,41 @@ index 000000000..f2b1f1179 + u32 cnt = 0, sum = 0; + + for_each_thread(p, task) { -+ if (!task_burst_inheritable(task)) continue; ++ if (!task_is_bore_eligible(task)) continue; + cnt++; + sum += task->se.burst_penalty; + } + -+ __update_tg_burst_cache(p, cnt, sum, now); ++ update_burst_cache(&p->se.group_burst, p, cnt, sum, now); +} + -+static inline u8 __inherit_burst_tg(struct task_struct *p, u64 now) { ++static inline u8 inherit_burst_tg(struct task_struct *p, u64 now) { + struct task_struct *parent = p->group_leader; -+ if (tg_burst_cache_expired(parent, now)) ++ if (burst_cache_expired(&parent->se.group_burst, now)) + update_tg_burst(parent, now); + -+ return parent->se.tg_burst; ++ return parent->se.group_burst.score; +} + +void sched_clone_bore( + struct task_struct *p, struct task_struct *parent, u64 clone_flags) { -+ if (!task_burst_inheritable(p)) return; -+ -+ u8 penalty; -+ u8 clone_type = !(clone_flags & CLONE_THREAD) + 1; -+ u8 type_matched = sched_burst_atavistic_mask & clone_type; ++ if (!task_is_bore_eligible(p)) return; + + u64 now = ktime_get_ns(); + read_lock(&tasklist_lock); -+ penalty = (type_matched && likely(sched_burst_atavistic_depth)) ? -+ __inherit_burst_topological(parent, now): -+ ((clone_type == 2) ? -+ __inherit_burst_direct(parent, now): -+ __inherit_burst_tg(parent, now)); ++ u8 penalty = (clone_flags & CLONE_THREAD) ? ++ inherit_burst_tg(parent, now) : ++ likely(sched_burst_fork_atavistic) ? ++ inherit_burst_topological(parent, now): ++ inherit_burst_direct(parent, now); + read_unlock(&tasklist_lock); + + struct sched_entity *se = &p->se; -+ __revolve_burst_penalty(se); ++ revolve_burst_penalty(se); + se->burst_penalty = se->prev_burst_penalty = + max(se->prev_burst_penalty, penalty); -+ se->child_burst_last_cached = 0; -+ se->tg_burst_last_cached = 0; ++ se->child_burst.timestamp = 0; ++ se->group_burst.timestamp = 0; +} + +void init_task_bore(struct task_struct *p) { @@ -491,8 +479,8 @@ index 000000000..f2b1f1179 + p->se.curr_burst_penalty = 0; + p->se.burst_penalty = 0; + p->se.burst_score = 0; -+ p->se.child_burst_last_cached = 0; -+ p->se.tg_burst_last_cached = 0; ++ memset(&p->se.child_burst, 0, sizeof(struct sched_burst_cache)); ++ memset(&p->se.group_burst, 0, sizeof(struct sched_burst_cache)); +} + +#ifdef CONFIG_SYSCTL @@ -534,17 +522,8 @@ index 000000000..f2b1f1179 + .extra2 = SYSCTL_ONE, + }, + { -+ .procname = "sched_burst_atavistic_mask", -+ .data = &sched_burst_atavistic_mask, -+ .maxlen = sizeof(u8), -+ .mode = 0644, -+ .proc_handler = proc_dou8vec_minmax, -+ .extra1 = SYSCTL_ZERO, -+ .extra2 = SYSCTL_THREE, -+ }, -+ { -+ .procname = "sched_burst_atavistic_depth", -+ .data = &sched_burst_atavistic_depth, ++ .procname = "sched_burst_fork_atavistic", ++ .data = &sched_burst_fork_atavistic, + .maxlen = sizeof(u8), + .mode = 0644, + .proc_handler = proc_dou8vec_minmax, @@ -602,7 +581,7 @@ index 000000000..f2b1f1179 +#endif // CONFIG_SYSCTL +#endif // CONFIG_SCHED_BORE diff --git a/kernel/sched/core.c b/kernel/sched/core.c -index c792a6feb..2db0ce2be 100644 +index c792a6feb7a9..447ab2bb147e 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -97,6 +97,8 @@ @@ -619,7 +598,7 @@ index c792a6feb..2db0ce2be 100644 #endif +#ifdef CONFIG_SCHED_BORE -+ printk(KERN_INFO "BORE (Burst-Oriented Response Enhancer) CPU Scheduler modification 5.5.0 by Masahito Suzuki"); ++ printk(KERN_INFO "BORE (Burst-Oriented Response Enhancer) CPU Scheduler modification 5.6.0 by Masahito Suzuki"); + init_task_bore(&init_task); +#endif // CONFIG_SCHED_BORE + @@ -627,7 +606,7 @@ index c792a6feb..2db0ce2be 100644 #ifdef CONFIG_FAIR_GROUP_SCHED diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c -index c057ef46c..3cab39e34 100644 +index c057ef46c5f8..3cab39e34824 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -167,7 +167,52 @@ static const struct file_operations sched_feat_fops = { @@ -734,7 +713,7 @@ index c057ef46c..3cab39e34 100644 P(se.avg.runnable_sum); P(se.avg.util_sum); diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c -index 2928026d7..b4260f1bb 100644 +index 2928026d76a3..90c96ecded2d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -55,6 +55,8 @@ @@ -802,21 +781,26 @@ index 2928026d7..b4260f1bb 100644 #ifdef CONFIG_NUMA_BALANCING /* Restrict the NUMA promotion throughput (MB/s) for each target node. */ -@@ -201,6 +202,13 @@ static inline void update_load_set(struct load_weight *lw, unsigned long w) +@@ -201,6 +202,18 @@ static inline void update_load_set(struct load_weight *lw, unsigned long w) * * This idea comes from the SD scheduler of Con Kolivas: */ +#ifdef CONFIG_SCHED_BORE +static void update_sysctl(void) { -+ sysctl_sched_base_slice = -+ max(sysctl_sched_min_base_slice, configured_sched_base_slice); ++ unsigned int base_slice = configured_sched_base_slice; ++ unsigned int min_base_slice = sysctl_sched_min_base_slice; ++ ++ if (min_base_slice) ++ base_slice *= DIV_ROUND_UP(min_base_slice, base_slice); ++ ++ sysctl_sched_base_slice = base_slice; +} +void sched_update_min_base_slice(void) { update_sysctl(); } +#else // !CONFIG_SCHED_BORE static unsigned int get_update_sysctl_factor(void) { unsigned int cpus = min_t(unsigned int, num_online_cpus(), 8); -@@ -231,6 +239,7 @@ static void update_sysctl(void) +@@ -231,6 +244,7 @@ static void update_sysctl(void) SET_SYSCTL(sched_base_slice); #undef SET_SYSCTL } @@ -824,7 +808,7 @@ index 2928026d7..b4260f1bb 100644 void __init sched_init_granularity(void) { -@@ -708,6 +717,9 @@ static s64 entity_lag(u64 avruntime, struct sched_entity *se) +@@ -708,6 +722,9 @@ static s64 entity_lag(u64 avruntime, struct sched_entity *se) vlag = avruntime - se->vruntime; limit = calc_delta_fair(max_t(u64, 2*se->slice, TICK_NSEC), se); @@ -834,7 +818,7 @@ index 2928026d7..b4260f1bb 100644 return clamp(vlag, -limit, limit); } -@@ -909,6 +921,10 @@ static struct sched_entity *pick_eevdf(struct cfs_rq *cfs_rq) +@@ -909,6 +926,10 @@ static struct sched_entity *pick_eevdf(struct cfs_rq *cfs_rq) * until it gets a new slice. See the HACK in set_next_entity(). */ if (sched_feat(RUN_TO_PARITY) && curr && curr->vlag == curr->deadline) @@ -845,7 +829,7 @@ index 2928026d7..b4260f1bb 100644 return curr; /* Pick the leftmost entity if it's eligible */ -@@ -967,6 +983,7 @@ struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq) +@@ -967,6 +988,7 @@ struct sched_entity *__pick_last_entity(struct cfs_rq *cfs_rq) * Scheduling class statistics methods: */ #ifdef CONFIG_SMP @@ -853,7 +837,7 @@ index 2928026d7..b4260f1bb 100644 int sched_update_scaling(void) { unsigned int factor = get_update_sysctl_factor(); -@@ -978,6 +995,7 @@ int sched_update_scaling(void) +@@ -978,6 +1000,7 @@ int sched_update_scaling(void) return 0; } @@ -861,7 +845,7 @@ index 2928026d7..b4260f1bb 100644 #endif #endif -@@ -1178,6 +1196,10 @@ static void update_curr(struct cfs_rq *cfs_rq) +@@ -1178,6 +1201,10 @@ static void update_curr(struct cfs_rq *cfs_rq) if (unlikely(delta_exec <= 0)) return; @@ -872,7 +856,7 @@ index 2928026d7..b4260f1bb 100644 curr->vruntime += calc_delta_fair(delta_exec, curr); update_deadline(cfs_rq, curr); update_min_vruntime(cfs_rq); -@@ -3795,7 +3817,7 @@ static void reweight_eevdf(struct sched_entity *se, u64 avruntime, +@@ -3795,7 +3822,7 @@ static void reweight_eevdf(struct sched_entity *se, u64 avruntime, se->deadline = avruntime + vslice; } @@ -881,7 +865,7 @@ index 2928026d7..b4260f1bb 100644 unsigned long weight) { bool curr = cfs_rq->curr == se; -@@ -5203,6 +5225,9 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) +@@ -5203,6 +5230,9 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) * * EEVDF: placement strategy #1 / #2 */ @@ -891,7 +875,7 @@ index 2928026d7..b4260f1bb 100644 if (sched_feat(PLACE_LAG) && cfs_rq->nr_running) { struct sched_entity *curr = cfs_rq->curr; unsigned long load; -@@ -5273,6 +5298,18 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) +@@ -5273,6 +5303,16 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) se->vruntime = vruntime - lag; @@ -901,16 +885,14 @@ index 2928026d7..b4260f1bb 100644 + return; + } +#ifdef CONFIG_SCHED_BORE -+ else if (likely(sched_bore)) { -+ if (flags & sched_deadline_boost_mask) -+ vslice /= 2; -+ } ++ else if (likely(sched_bore)) ++ vslice >>= !!(flags & sched_deadline_boost_mask); + else +#endif // CONFIG_SCHED_BORE /* * When joining the competition; the existing tasks will be, * on average, halfway through their slice, as such start tasks -@@ -5382,6 +5419,7 @@ static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq); +@@ -5382,6 +5422,7 @@ static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq); static void dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) { @@ -918,7 +900,7 @@ index 2928026d7..b4260f1bb 100644 int action = UPDATE_TG; if (entity_is_task(se) && task_on_rq_migrating(task_of(se))) -@@ -5409,6 +5447,11 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) +@@ -5409,6 +5450,11 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags) clear_buddies(cfs_rq, se); update_entity_lag(cfs_rq, se); @@ -930,7 +912,7 @@ index 2928026d7..b4260f1bb 100644 if (se != cfs_rq->curr) __dequeue_entity(cfs_rq, se); se->on_rq = 0; -@@ -6860,6 +6903,14 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags) +@@ -6860,6 +6906,14 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags) bool was_sched_idle = sched_idle_rq(rq); util_est_dequeue(&rq->cfs, p); @@ -945,7 +927,7 @@ index 2928026d7..b4260f1bb 100644 for_each_sched_entity(se) { cfs_rq = cfs_rq_of(se); -@@ -8646,16 +8697,25 @@ static void yield_task_fair(struct rq *rq) +@@ -8646,16 +8700,25 @@ static void yield_task_fair(struct rq *rq) /* * Are we the only task in the tree? */ @@ -971,7 +953,7 @@ index 2928026d7..b4260f1bb 100644 /* * Tell update_rq_clock() that we've just updated, * so we don't do microscopic update in schedule() -@@ -12720,6 +12780,9 @@ static void task_fork_fair(struct task_struct *p) +@@ -12720,6 +12783,9 @@ static void task_fork_fair(struct task_struct *p) curr = cfs_rq->curr; if (curr) update_curr(cfs_rq); @@ -981,7 +963,7 @@ index 2928026d7..b4260f1bb 100644 place_entity(cfs_rq, se, ENQUEUE_INITIAL); rq_unlock(rq, &rf); } -@@ -12832,6 +12895,10 @@ static void attach_task_cfs_rq(struct task_struct *p) +@@ -12832,6 +12898,10 @@ static void attach_task_cfs_rq(struct task_struct *p) static void switched_from_fair(struct rq *rq, struct task_struct *p) { @@ -993,7 +975,7 @@ index 2928026d7..b4260f1bb 100644 } diff --git a/kernel/sched/features.h b/kernel/sched/features.h -index 143f55df8..e97b7b68b 100644 +index 143f55df890b..e97b7b68bdd3 100644 --- a/kernel/sched/features.h +++ b/kernel/sched/features.h @@ -6,6 +6,10 @@ @@ -1008,10 +990,10 @@ index 143f55df8..e97b7b68b 100644 /* diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h -index 207a04f02..c99430161 100644 +index 48d893de632b..62e7e9e5fd9c 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h -@@ -2063,7 +2063,11 @@ static inline void update_sched_domain_debugfs(void) { } +@@ -2065,7 +2065,11 @@ static inline void update_sched_domain_debugfs(void) { } static inline void dirty_sched_domain_sysctl(int cpu) { } #endif @@ -1023,7 +1005,7 @@ index 207a04f02..c99430161 100644 static inline const struct cpumask *task_user_cpus(struct task_struct *p) { -@@ -2736,6 +2740,9 @@ extern const_debug unsigned int sysctl_sched_nr_migrate; +@@ -2738,6 +2742,9 @@ extern const_debug unsigned int sysctl_sched_nr_migrate; extern const_debug unsigned int sysctl_sched_migration_cost; extern unsigned int sysctl_sched_base_slice; @@ -1034,4 +1016,4 @@ index 207a04f02..c99430161 100644 #ifdef CONFIG_SCHED_DEBUG extern int sysctl_resched_latency_warn_ms; -- -2.46.0.469.g4590f2e941 +2.46.2