提交 403f0d0c 编写于 作者: G Guan Jing 提交者: Zheng Zengkai

sched: programmable: Add hook for pick next task

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5KUFB
CVE: NA

--------------------------------

This hook point can change the position of se on the red-black tree,
eg:  in cloud scenarios, there will be online tasks that need to
respond in time and offline tasks that do not need to respond in time.
This hook point provides users with a way to customize that
Class tasks run first.
The basis for pick next task comes from system information,
such as the red-black tree, and so on… If the system
information of the CFS is modified, it will affect
the whole system. Therefore, the hook function is added here.
Only the position of the task on the red-black tree is modified,
and the value of vruntime is not changed.
Signed-off-by: NGuan Jing <guanjing6@huawei.com>
上级 2c1189e3
......@@ -6,3 +6,5 @@ BPF_SCHED_HOOK(int, 0, cfs_wakeup_preempt_entity, struct sched_entity *curr,
BPF_SCHED_HOOK(int, -1, cfs_select_rq, struct sched_migrate_ctx *ctx)
BPF_SCHED_HOOK(int, -1, cfs_wake_affine, struct sched_affine_ctx *ctx)
BPF_SCHED_HOOK(int, -1, cfs_select_rq_exit, struct sched_migrate_ctx *ctx)
BPF_SCHED_HOOK(int, 0, cfs_tag_pick_next_entity, struct sched_entity *curr,
struct sched_entity *next)
......@@ -513,6 +513,15 @@ static inline u64 min_vruntime(u64 min_vruntime, u64 vruntime)
static inline int entity_before(struct sched_entity *a,
struct sched_entity *b)
{
#ifdef CONFIG_BPF_SCHED
if (bpf_sched_enabled()) {
int ret = bpf_sched_cfs_tag_pick_next_entity(a, b);
if (ret == 1)
return 1;
}
#endif
return (s64)(a->vruntime - b->vruntime) < 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册