cgroup, sched: add bpf for cgroup cpu controller - #13277
cgroup, sched: add bpf for cgroup cpu controller#13277kernel-patches-daemon-bpf[bot] wants to merge 2 commits into
Conversation
|
Upstream branch: 806c1a1 |
AI reviewed your patch. Please fix the bug or email reply why it's not a bug. In-Reply-To-Subject: |
AI reviewed your patch. Please fix the bug or email reply why it's not a bug. In-Reply-To-Subject: |
|
Forwarding comment 5285813709 via email |
|
Forwarding comment 5285824105 via email |
6220a54 to
fa81f18
Compare
|
Upstream branch: aacd13e |
961f08b to
b1b1055
Compare
fa81f18 to
fdd9d75
Compare
|
Upstream branch: 259d60f |
b1b1055 to
99d1327
Compare
fdd9d75 to
c66e1e2
Compare
|
Upstream branch: 4d9551b |
99d1327 to
5a0673e
Compare
c66e1e2 to
114cb6a
Compare
|
Upstream branch: 409a9bd |
5a0673e to
0ab9474
Compare
114cb6a to
ddff495
Compare
|
Upstream branch: c7e6175 |
0ab9474 to
b78ecbe
Compare
ddff495 to
b9ccff2
Compare
|
Upstream branch: f2aaa62 |
7b509dc to
93097fe
Compare
|
Upstream branch: 8eb1892 |
f3f3ba7 to
76d4648
Compare
93097fe to
b51acce
Compare
|
Upstream branch: d99bda7 |
76d4648 to
fb98c6a
Compare
b51acce to
b27c6f9
Compare
|
Upstream branch: 34e0eb7 |
fb98c6a to
d1e5442
Compare
b27c6f9 to
5d621a7
Compare
|
Upstream branch: 5fe7007 |
d1e5442 to
fdd209e
Compare
5d621a7 to
81e4232
Compare
|
Upstream branch: 77877bf |
fdd209e to
59b44e3
Compare
81e4232 to
f0e6afe
Compare
|
Upstream branch: adb7719 |
59b44e3 to
5e66b4b
Compare
f0e6afe to
7ac20a0
Compare
|
Upstream branch: 6b0835a |
5e66b4b to
f867be7
Compare
7ac20a0 to
fd7f5fa
Compare
|
Upstream branch: 6ab6a94 |
f867be7 to
029c44c
Compare
fd7f5fa to
23ff631
Compare
This series adds bpf kfuncs for the cgroup CPU controller, following the memory controller kfuncs in mm/bpf_memcontrol.c. Collecting cgroup statistics is expensive: the existing method is to open and parse a cgroup file. memcg already has an efficient alternative through BPF; this series extends that idea to cpu. Design: - Leave reading the CFS bandwidth counters to the BPF program. They are plain fields of tg->cfs_bandwidth, so they need no kernel code. - Add one kfunc to compute the throttled time. This is necessary because it is a sum over every possible cpu, which a user cannot do itself. - The bpf_cpu_cgroup_cputime() returns all five base CPU-time values in one call with one cputime_adjust(). The only part it touches the scheduler part is to discard the static for throttled_time_self() in order to use externally. The two kfuncs that take the rstat lock are KF_SLEEPABLE following idea in the mm/bpf_memcontrol.c Suggested-by: Shakeel Butt <shakeel.butt@linux.dev> Assisted-by: Claude:claude-opus-5 Signed-off-by: Ziyang Men <ziyang.meme@gmail.com>
Add cgroup_iter_cpu, a selftest for the added CPU controller BPF kfuncs.
The userspace side runs a CPU hog in a test cgroup with cpu.max settled
then:
- checks the CPU-time and throttling counters are nonzero,
- compares whether all values the program read are same as those
reading from cgroup file.
CONFIG_CGROUP_SCHED, CONFIG_FAIR_GROUP_SCHED and CONFIG_CFS_BANDWIDTH
are added to the test config.
Tests passed on v7.2-rc5.
Suggested-by: Shakeel Butt <shakeel.butt@linux.dev>
Assisted-by: Claude:claude-opus-5
Signed-off-by: Ziyang Men <ziyang.meme@gmail.com>
|
Upstream branch: 3d9393f |
029c44c to
d15b6fb
Compare
Pull request for series with
subject: cgroup, sched: add bpf for cgroup cpu controller
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1145678