Unverified Commit 80748ad9 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!323 [OLK-5.10] sched: Introduce priority load balance for CFS

Merge Pull Request from: @zhangsong234 
 
euleros inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5HF3M
CVE: NA

Add new sysctl interface:
`/proc/sys/kernel/sched_prio_load_balance_enabled`

 0: default behavior
 1: enable priority load balance for qos scheduler

For tasks co-location with qos scheduler, when CFS do load balance,
it is reasonable to prefer migrating online(Latency Sensitive) tasks.
So the CFS load balance can be changed to below:

1) `cfs_tasks` list is owned by online tasks.
2) Add new `cfs_offline_tasks` list which is owned by offline tasks.
3) Prefer to migrate the online tasks of `cfs_tasks` list to dst rq.

In the scenario of hyperthread interference, if the smt expeller feature
enabled, CPU A and CPU B are two hyperthreads on a physical core,
CPU A runs online tasks while CPU B only has offline tasks, The offline
tasks on CPU B are expelled by the online tasks on CPU A and cannot be
scheduled. However, when load balance is triggered, before CPU B can
migrate some online tasks from CPU A, the load on the two cpus is already
balanced. As a result, CPU B cannot run online tasks and online tasks
cannot be evenly distributed among different cpus. 
 
Link:https://gitee.com/openeuler/kernel/pulls/323

 

Reviewed-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: default avatarZucheng Zheng <zhengzucheng@huawei.com>
Reviewed-by: default avatarLiu Chao <liuchao173@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parents 7a9bd93b 29ec6e95
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -141,6 +141,7 @@ CONFIG_CGROUP_SCHED=y
CONFIG_QOS_SCHED=y
# CONFIG_QOS_SCHED_SMT_EXPELLER is not set
CONFIG_FAIR_GROUP_SCHED=y
CONFIG_QOS_SCHED_PRIO_LB=y
CONFIG_CFS_BANDWIDTH=y
CONFIG_RT_GROUP_SCHED=y
CONFIG_CGROUP_PIDS=y
+1 −0
Original line number Diff line number Diff line
@@ -160,6 +160,7 @@ CONFIG_CGROUP_SCHED=y
CONFIG_QOS_SCHED=y
# CONFIG_QOS_SCHED_SMT_EXPELLER is not set
CONFIG_FAIR_GROUP_SCHED=y
CONFIG_QOS_SCHED_PRIO_LB=y
CONFIG_CFS_BANDWIDTH=y
CONFIG_RT_GROUP_SCHED=y
CONFIG_CGROUP_PIDS=y
+4 −0
Original line number Diff line number Diff line
@@ -79,6 +79,10 @@ extern unsigned int sysctl_overload_detect_period;
extern unsigned int sysctl_offline_wait_interval;
#endif

#ifdef CONFIG_QOS_SCHED_PRIO_LB
extern unsigned int sysctl_sched_prio_load_balance_enabled;
#endif

#ifdef CONFIG_SCHED_AUTOGROUP
extern unsigned int sysctl_sched_autogroup_enabled;
#endif
+9 −0
Original line number Diff line number Diff line
@@ -986,6 +986,15 @@ config QOS_SCHED_SMT_EXPELLER
	  This feature enable online tasks to expel offline tasks
	  on the smt sibling cpus, and exclusively occupy CPU resources.

config QOS_SCHED_PRIO_LB
	bool "Priority load balance for Qos scheduler"
	depends on QOS_SCHED
	default n
	help
	  This feature enable priority load balance
	  for Qos scheduler, which prefer migrating online tasks
	  and migrating offline tasks secondly between CPUs.

config FAIR_GROUP_SCHED
	bool "Group scheduling for SCHED_OTHER"
	depends on CGROUP_SCHED
+3 −0
Original line number Diff line number Diff line
@@ -8273,6 +8273,9 @@ void __init sched_init(void)
		rq->max_idle_balance_cost = sysctl_sched_migration_cost;

		INIT_LIST_HEAD(&rq->cfs_tasks);
#ifdef CONFIG_QOS_SCHED_PRIO_LB
		INIT_LIST_HEAD(&rq->cfs_offline_tasks);
#endif

		rq_attach_root(rq, &def_root_domain);
#ifdef CONFIG_NO_HZ_COMMON
Loading