
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ICFKYV -------------------------------- Add bpf_sched_cfs_exec_set_cpumask hook in exec_binprm, which allows setting cpumask for the process. Signed-off-by: Cheng Yu <serein.chengyu@huawei.com> --- fs/exec.c | 7 +++++++ include/linux/sched_hook_defs.h | 1 + 2 files changed, 8 insertions(+) diff --git a/fs/exec.c b/fs/exec.c index 2ac3ef80628f..3dd371dfa89c 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -75,6 +75,7 @@ #include "internal.h" #include <trace/events/sched.h> +#include <linux/bpf_sched.h> static int bprm_creds_from_file(struct linux_binprm *bprm); @@ -1846,6 +1847,12 @@ static int exec_binprm(struct linux_binprm *bprm) trace_sched_process_exec(current, old_pid, bprm); ptrace_event(PTRACE_EVENT_EXEC, old_vpid); proc_exec_connector(current); + +#ifdef CONFIG_BPF_SCHED + if (bpf_sched_enabled()) + bpf_sched_cfs_exec_init(current); +#endif + return 0; } diff --git a/include/linux/sched_hook_defs.h b/include/linux/sched_hook_defs.h index 57b7f61d515c..ef3feef2fee3 100644 --- a/include/linux/sched_hook_defs.h +++ b/include/linux/sched_hook_defs.h @@ -6,3 +6,4 @@ BPF_SCHED_HOOK(int, -1, cfs_tag_entity_eligible, struct sched_entity *se) BPF_SCHED_HOOK(int, -1, cfs_tag_pick_next_entity, const struct sched_entity *curr, const struct sched_entity *next) +BPF_SCHED_HOOK(void, (void) 0, cfs_exec_init, struct task_struct *tsk) -- 2.25.1