This patchset aims to introduce tag mechanism, that is, the tag field is added to struct task_struct and struct task_group. Users can use the file system interface to mark different tags for specific workloads. Other kernel subsystem can use the helper function to set different tags for workloads. The sched bpf prog obtains the tags to detect different workloads.
It also aims to add new BPF hooks to the schduler in select_task_rq_fair() and entity_before() which use to impact the "select rq" and "pick next task" process. The helper functions is also added to obtanin kernel state like cpu statistics and cpu topology. In addition to that, there are cpumask ops helpers collection, a lib for sched bpf prog, and the samples.
Chen Hui (11): sched: programmable: Add a tag for the task group sched: programmable: Add user interface of task group tag sched: programmable: Add a tag for the task sched: programmable: Add user interface of task tag sched: programmable: add bpf_sched_task_tag_of helper function sched: programmable: Add convenient helper functions to convert sched entity samples/bpf: Update bpf loader for sched section names bpf: sched: Add four helper functions to get cpu stat bpf:programmable: Add cpumask ops collection sched: programmable: Add lib for sched programmable sched: programmable: Add three hooks in select_task_rq_fair()
Guan Jing (2): sched: programmable: Add hook for pick next task samples: bpf: Add bpf sched pick task sample
Hui Tang (3): bpf:programmable: Add helper func to check cpu share cache bpf:programmable: Add helper func to set cpus_ptr in task samples:bpf: Add samples for cfs select core
Ren Zhijie (5): sched: programmable: Fix sched bpf hook cfs_check_preempt_tick sched: programmable: add bpf_sched_tg_tag_of helper function samples: bpf: Add bpf sched preempt sample program sched: programmable: Add helpers to set tag of task or task_group sched: programmable: Add helper function for cpu topology.
fs/proc/base.c | 65 ++++ include/linux/bpf_topology.h | 46 +++ include/linux/sched.h | 85 +++++ include/linux/sched_hook_defs.h | 5 + include/uapi/linux/bpf.h | 151 +++++++++ init/init_task.c | 3 + kernel/bpf/helpers.c | 12 + kernel/bpf/verifier.c | 4 +- kernel/sched/Makefile | 3 +- kernel/sched/bpf_sched.c | 436 ++++++++++++++++++++++++ kernel/sched/bpf_topology.c | 97 ++++++ kernel/sched/core.c | 103 ++++++ kernel/sched/fair.c | 64 +++- kernel/sched/sched.h | 8 + samples/bpf/Makefile | 9 + samples/bpf/bpf_load.c | 8 +- samples/bpf/sched_pick_task_kern.c | 56 ++++ samples/bpf/sched_pick_task_user.c | 94 ++++++ samples/bpf/sched_preempt_kern.c | 147 +++++++++ samples/bpf/sched_preempt_user.c | 140 ++++++++ samples/bpf/sched_select_core_kern.c | 259 +++++++++++++++ samples/bpf/sched_select_core_user.c | 125 +++++++ scripts/bpf_helpers_doc.py | 20 ++ tools/include/uapi/linux/bpf.h | 151 +++++++++ tools/lib/bpf/libbpf_sched.h | 473 +++++++++++++++++++++++++++ 25 files changed, 2558 insertions(+), 6 deletions(-) create mode 100644 include/linux/bpf_topology.h create mode 100644 kernel/sched/bpf_topology.c create mode 100644 samples/bpf/sched_pick_task_kern.c create mode 100644 samples/bpf/sched_pick_task_user.c create mode 100644 samples/bpf/sched_preempt_kern.c create mode 100644 samples/bpf/sched_preempt_user.c create mode 100644 samples/bpf/sched_select_core_kern.c create mode 100644 samples/bpf/sched_select_core_user.c create mode 100644 tools/lib/bpf/libbpf_sched.h