hulk inclusion category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IBA1PI
--------------------------------
Reducing the select_task_rq run time by Checking the enable status of dynamic affinity before attempting to hold rcu_lock and deleting the enable check int dynamic_affinity_mode function.
Inline functions are used to reduce the execution time of pick_next_time functions.
Fixes: 6eb07f9925a9 ("sched: Introduce smart grid scheduling strategy for cfs") Signed-off-by: He Yujie coka.heyujie@huawei.com --- kernel/sched/fair.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index f1cd57e70f1f..88ff8783978b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6844,9 +6844,6 @@ static inline struct cpumask *task_prefer_cpus(struct task_struct *p)
static inline int dynamic_affinity_mode(struct task_struct *p) { - if (!prefer_cpus_valid(p)) - return -1; - if (smart_grid_used()) return task_group(p)->auto_affinity->mode == 0 ? -1 : 1;
@@ -7307,9 +7304,6 @@ static inline struct cpumask *task_prefer_cpus(struct task_struct *p)
static inline int dynamic_affinity_mode(struct task_struct *p) { - if (!prefer_cpus_valid(p)) - return -1; - return 0; } #endif /* CONFIG_QOS_SCHED_DYNAMIC_AFFINITY */ @@ -9038,6 +9032,9 @@ static void set_task_select_cpus(struct task_struct *p, int *idlest_cpu, int cpu, mode;
p->select_cpus = p->cpus_ptr; + if (!prefer_cpus_valid(p)) + return; + rcu_read_lock(); mode = dynamic_affinity_mode(p); if (mode == -1) { @@ -9721,7 +9718,7 @@ static int __init qos_sched_smt_noexpell_setup(char *__unused) } __setup("nosmtexpell", qos_sched_smt_noexpell_setup);
-static bool qos_smt_check_siblings_status(int this_cpu) +static __always_inline bool qos_smt_check_siblings_status(int this_cpu) { int cpu;