From 7c77d81a69320101cb95e76c6c73f2348444b6ee Mon Sep 17 00:00:00 2001 From: tianmuyang Date: Sat, 13 Sep 2025 18:44:34 +0800 Subject: [PATCH] tuned-ebpf: Add "AND" logic of cpu mask in eBPF programmable schedule Signed-off-by: tianmuyang --- ...ND-logic-of-cpu-mask-in-eBPF-program.patch | 47 +++++++++++++++++++ tuned.spec | 6 ++- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 profiles-tuned-ebpf-Add-AND-logic-of-cpu-mask-in-eBPF-program.patch diff --git a/profiles-tuned-ebpf-Add-AND-logic-of-cpu-mask-in-eBPF-program.patch b/profiles-tuned-ebpf-Add-AND-logic-of-cpu-mask-in-eBPF-program.patch new file mode 100644 index 0000000..5f3a8a4 --- /dev/null +++ b/profiles-tuned-ebpf-Add-AND-logic-of-cpu-mask-in-eBPF-program.patch @@ -0,0 +1,47 @@ +From f3006a83e1728100c6c96d6b843962154f9d32d0 Mon Sep 17 00:00:00 2001 +From: tianmuyang +Date: Mon, 15 Sep 2025 20:27:10 +0800 +Subject: [PATCH] tuned-ebpf: Add "AND" logic of cpu mask in eBPF programmable + schedule + +Signed-off-by: tianmuyang +--- + tuned/ebpf/programmable_sched_kern.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/tuned/ebpf/programmable_sched_kern.c b/tuned/ebpf/programmable_sched_kern.c +index 4e96801..afc0783 100644 +--- a/tuned/ebpf/programmable_sched_kern.c ++++ b/tuned/ebpf/programmable_sched_kern.c +@@ -99,6 +99,20 @@ static __always_inline int libbpf_sched_set_task_prefer_cpumask(struct task_stru + return bpf_sched_set_task_prefer_cpumask(tsk, mask, len); + } + ++static __always_inline long libbpf_cpumask_and(struct cpumask *dst, ++ struct cpumask *src1, ++ struct cpumask *src2) ++{ ++ struct cpumask_op_args op; ++ ++ op.op_type = CPUMASK_AND; ++ op.arg1 = dst; ++ op.arg2 = src1; ++ op.arg3 = src2; ++ op.arg4 = INVALID_PTR; ++ return bpf_cpumask_op(&op, sizeof(op)); ++} ++ + static __always_inline int str_prefix(char *str, char *prefix) + { + int i = 0; +@@ -199,6 +213,7 @@ void BPF_PROG(programmable_sched, struct task_struct *p) + + libbpf_node_set(cur_index, &mask_info->node_mask); + libbpf_nodemask_to_cpumask(&mask_info->node_mask, &mask_info->cpu_mask); ++ libbpf_cpumask_and(&mask_info->cpu_mask, &mask_info->cpu_mask, (struct cpumask*)p->cpus_ptr); + + __sync_fetch_and_add(&numa_info->numa_index, 1); + mask_info->pid = p->pid; +-- +2.33.0 + diff --git a/tuned.spec b/tuned.spec index 313d0e1..d140fd4 100644 --- a/tuned.spec +++ b/tuned.spec @@ -1,7 +1,7 @@ Summary: A system tuning service for Linux Name: tuned Version: 2.24.1 -Release: 4 +Release: 5 License: GPLv2+ Source0: https://github.com/redhat-performance/%{name}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz URL: http://www.tuned-project.org/ @@ -43,6 +43,7 @@ Patch8: profiles-add-spark.patch Patch9: profiles-Add-programmable-scheduling-based-on-eBPF.patch Patch10: profiles-Add-vmlinux-to-support-eBPF-program-compila.patch Patch11: support-optional-param-filter-arg_prefix.patch +Patch12: profiles-tuned-ebpf-Add-AND-logic-of-cpu-mask-in-eBPF-program.patch Provides: tuned-gtk = %{version}-%{release} Provides: tuned-utils = %{version}-%{release} @@ -306,6 +307,9 @@ fi %{_mandir}/man7/tuned-profiles-spectrumscale-ece.7* %changelog +* Mon Sep 15 2025 tianmuyang - 2.24.1-5 +- tuned-ebpf: Add "AND" logic of cpu mask in eBPF programmable schedule + * Sun Sep 14 2025 wuchangye - 2.24.1-4 - tuned-ebpf: support optional param filter: arg_prefix -- Gitee