提交 51f84117 编写于 作者: C Chen Hui 提交者: Ma Wupeng

sched: programmable: Add a tag for the task group

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

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

Add a tag for the task group, to support the tag-based
scheduling mechanism.

The tag is used to identify a special task or a type of
special tasks, there are many special tasks in the real
world, such as foreground and background tasks, online
and offline tasks, ect. so, we can identify such special
tasks, and execute specific policies.
Signed-off-by: NChen Hui <judy.chenhui@huawei.com>
Signed-off-by: NRen Zhijie <renzhijie2@huawei.com>
Signed-off-by: NHui Tang <tanghui20@huawei.com>
上级 224980fd
...@@ -8603,6 +8603,13 @@ static void sched_free_group(struct task_group *tg) ...@@ -8603,6 +8603,13 @@ static void sched_free_group(struct task_group *tg)
kmem_cache_free(task_group_cache, tg); kmem_cache_free(task_group_cache, tg);
} }
#ifdef CONFIG_BPF_SCHED
static inline void tg_init_tag(struct task_group *tg, struct task_group *ptg)
{
tg->tag = ptg->tag;
}
#endif
/* allocate runqueue etc for a new task group */ /* allocate runqueue etc for a new task group */
struct task_group *sched_create_group(struct task_group *parent) struct task_group *sched_create_group(struct task_group *parent)
{ {
...@@ -8623,6 +8630,10 @@ struct task_group *sched_create_group(struct task_group *parent) ...@@ -8623,6 +8630,10 @@ struct task_group *sched_create_group(struct task_group *parent)
if (!alloc_rt_sched_group(tg, parent)) if (!alloc_rt_sched_group(tg, parent))
goto err; goto err;
#ifdef CONFIG_BPF_SCHED
tg_init_tag(tg, parent);
#endif
alloc_uclamp_sched_group(tg, parent); alloc_uclamp_sched_group(tg, parent);
return tg; return tg;
...@@ -8694,6 +8705,14 @@ static void sched_change_group(struct task_struct *tsk, int type) ...@@ -8694,6 +8705,14 @@ static void sched_change_group(struct task_struct *tsk, int type)
sched_change_qos_group(tsk, tg); sched_change_qos_group(tsk, tg);
#endif #endif
#ifdef CONFIG_BPF_SCHED
/*
* This function has cleared and restored the task status,
* so we do not need to dequeue and enqueue the task again.
*/
tsk->tag = tg->tag;
#endif
#ifdef CONFIG_FAIR_GROUP_SCHED #ifdef CONFIG_FAIR_GROUP_SCHED
if (tsk->sched_class->task_change_group) if (tsk->sched_class->task_change_group)
tsk->sched_class->task_change_group(tsk, type); tsk->sched_class->task_change_group(tsk, type);
......
...@@ -454,7 +454,12 @@ struct task_group { ...@@ -454,7 +454,12 @@ struct task_group {
struct uclamp_se uclamp[UCLAMP_CNT]; struct uclamp_se uclamp[UCLAMP_CNT];
#endif #endif
#ifdef CONFIG_BPF_SCHED
/* Used to pad the tag of a group */
KABI_USE(1, long tag)
#else
KABI_RESERVE(1) KABI_RESERVE(1)
#endif
KABI_RESERVE(2) KABI_RESERVE(2)
KABI_RESERVE(3) KABI_RESERVE(3)
KABI_RESERVE(4) KABI_RESERVE(4)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册