提交 b07932e2 编写于 作者: C Chen Hui 提交者: Zheng Zengkai

sched: programmable: Add a tag for the task

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

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

Add a tag for the task, useful to identify the special task.
User can use the file system interface to mark different tags for
specific workloads.
The kernel subsystems can use the set_* helpers to mark it too.
The bpf prog obtains the tags to detect different workloads.
Signed-off-by: NChen Hui <judy.chenhui@huawei.com>
Signed-off-by: NRen Zhijie <renzhijie2@huawei.com>
上级 77277550
...@@ -1397,7 +1397,12 @@ struct task_struct { ...@@ -1397,7 +1397,12 @@ struct task_struct {
*/ */
randomized_struct_fields_end randomized_struct_fields_end
#ifdef CONFIG_BPF_SCHED
/* Used to pad the tag of a task */
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)
......
...@@ -213,6 +213,9 @@ struct task_struct init_task ...@@ -213,6 +213,9 @@ struct task_struct init_task
#ifdef CONFIG_SECCOMP_FILTER #ifdef CONFIG_SECCOMP_FILTER
.seccomp = { .filter_count = ATOMIC_INIT(0) }, .seccomp = { .filter_count = ATOMIC_INIT(0) },
#endif #endif
#ifdef CONFIG_BPF_SCHED
.tag = 0,
#endif
}; };
EXPORT_SYMBOL(init_task); EXPORT_SYMBOL(init_task);
......
...@@ -3113,6 +3113,9 @@ static void __sched_fork(unsigned long clone_flags, struct task_struct *p) ...@@ -3113,6 +3113,9 @@ static void __sched_fork(unsigned long clone_flags, struct task_struct *p)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
p->wake_entry.u_flags = CSD_TYPE_TTWU; p->wake_entry.u_flags = CSD_TYPE_TTWU;
#endif #endif
#ifdef CONFIG_BPF_SCHED
p->tag = 0;
#endif
} }
DEFINE_STATIC_KEY_FALSE(sched_numa_balancing); DEFINE_STATIC_KEY_FALSE(sched_numa_balancing);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册