
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 e328d435be64..4d01aebf5500 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -77,6 +77,7 @@ #include "internal.h" #include <trace/events/sched.h> +#include <linux/bpf_sched.h> static int bprm_creds_from_file(struct linux_binprm *bprm); @@ -1823,6 +1824,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_set_cpumask(current); +#endif + return 0; } diff --git a/include/linux/sched_hook_defs.h b/include/linux/sched_hook_defs.h index de6451930d8a..34eac1ffca2d 100644 --- a/include/linux/sched_hook_defs.h +++ b/include/linux/sched_hook_defs.h @@ -15,3 +15,4 @@ BPF_SCHED_HOOK(int, -1, cfs_can_migrate_task, struct task_struct *p, BPF_SCHED_HOOK(void, (void) 0, cfs_change_preferred_node, struct sched_preferred_node_ctx *ctx) BPF_SCHED_HOOK(int, -1, cfs_preferred_nid_init, struct task_struct *tsk) +BPF_SCHED_HOOK(int, -1, cfs_exec_set_cpumask, struct task_struct *tsk) -- 2.25.1