-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix runqlen.py with 4.15 kernel #1510
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following kernel commit changes linux_src:kernel/sched/sched.h struct cfs_rq structure: ``` commit 1ea6c46a23f1213d1972bfae220db5c165e27bba Author: Peter Zijlstra <[email protected]> Date: Sat May 6 15:59:54 2017 +0200 sched/fair: Propagate an effective runnable_load_avg The load balancer uses runnable_load_avg as load indicator. For !cgroup this is: runnable_load_avg = \Sum se->avg.load_avg ; where se->on_rq That is, a direct sum of all runnable tasks on that runqueue. As opposed to load_avg, which is a sum of all tasks on the runqueue, which includes a blocked component. ... ``` The commit is in kernel 4.15 release and will make current runqlen.py internal cfs_rq_partial structure not syncing with the kernel one. As a result, runqlen.py will produce incorrect results on 4.15. This patch attempts to solve this issue by compiling a bpf program, which accesses one of fields introduced by the above commit. The successful compilation will indicate that we should amend the cfs_rq_partial structure. Signed-off-by: Yonghong Song <[email protected]>
Thanks @yonghong-song , I like the code comment! |
ismhong
pushed a commit
to ismhong/bcc
that referenced
this pull request
May 8, 2023
runqlen / cpuunclaimed add check_runnable_weight_field() as workaround to check runnable_weight presents in struct cfs_rq in kernel/sched/sched.h by trying to access runnable_weight field of struct sched_entity in include/linux/sched.h. Please check more details in PR iovisor#1510 and iovisor#2164. Unfortunately, the runnable_weight field of struct cfs_rq is removed, but the runnable_weight field of struct sched_entity is remained by following patchset series from Linux version 5.7.0. - https://yhbt.net/lore/all/[email protected]/ - https://yhbt.net/lore/all/[email protected]/ Please also check the source of Linux below. - include/linux/sched.h - https://elixir.bootlin.com/linux/v5.7/source/include/linux/sched.h#L475 - kernel/sched/sched.h - https://elixir.bootlin.com/linux/v5.7/source/kernel/sched/sched.h#L502 This PR checks runnable_weight field exists by using kernel_struct_has_field() if target system with BTF enabled, otherwise fallback to legacy on-the-fly compiling check. In the meantime, add Linux version 5.7.0 check in structure definition cfs_rq_partial to prevent issue if target system w/o BTF enabled and Linux version > 5.7. Please check more details in iovisor#4602. Signed-off-by: Ism Hong <[email protected]>
ismhong
pushed a commit
to ismhong/bcc
that referenced
this pull request
May 8, 2023
runqlen / cpuunclaimed add check_runnable_weight_field() as workaround to check runnable_weight presents in struct cfs_rq in kernel/sched/sched.h by trying to access runnable_weight field of struct sched_entity in include/linux/sched.h. Please check more details in PR iovisor#1510 and iovisor#2164. Unfortunately, the runnable_weight field of struct cfs_rq is removed, but the runnable_weight field of struct sched_entity is remained by following patchset series from Linux version 5.7.0. - https://yhbt.net/lore/all/[email protected]/ - https://yhbt.net/lore/all/[email protected]/ Please also check the source of Linux below. - include/linux/sched.h - https://elixir.bootlin.com/linux/v5.7/source/include/linux/sched.h#L475 - kernel/sched/sched.h - https://elixir.bootlin.com/linux/v5.7/source/kernel/sched/sched.h#L502 This PR checks runnable_weight field exists by using kernel_struct_has_field() if target system with BTF enabled, otherwise fallback to legacy on-the-fly compiling check. In the meantime, add Linux version 5.7.0 check in structure definition cfs_rq_partial to prevent issue if target system w/o BTF enabled and Linux version > 5.7. Please check more details in iovisor#4602. Signed-off-by: Ism Hong <[email protected]>
ismhong
pushed a commit
to ismhong/bcc
that referenced
this pull request
May 16, 2023
runqlen / cpuunclaimed add check_runnable_weight_field() as workaround to check runnable_weight presents in struct cfs_rq in kernel/sched/sched.h by trying to access runnable_weight field of struct sched_entity in include/linux/sched.h. Please check more details in PR iovisor#1510 and iovisor#2164. Unfortunately, the runnable_weight field of struct cfs_rq is removed, but the runnable_weight field of struct sched_entity is remained by following patchset series from Linux version 5.7.0. - https://yhbt.net/lore/all/[email protected]/ - https://yhbt.net/lore/all/[email protected]/ Please also check the source of Linux below. - include/linux/sched.h - https://elixir.bootlin.com/linux/v5.7/source/include/linux/sched.h#L475 - kernel/sched/sched.h - https://elixir.bootlin.com/linux/v5.7/source/kernel/sched/sched.h#L502 This PR checks runnable_weight field exists by using kernel_struct_has_field() if target system with BTF enabled, otherwise fallback to legacy on-the-fly compiling check. In the meantime, add Linux version 5.7.0 check in structure definition cfs_rq_partial to prevent issue if target system w/o BTF enabled and Linux version > 5.7. Please check more details in iovisor#4602. Signed-off-by: Ism Hong <[email protected]>
yonghong-song
pushed a commit
that referenced
this pull request
May 19, 2023
runqlen / cpuunclaimed add check_runnable_weight_field() as workaround to check runnable_weight presents in struct cfs_rq in kernel/sched/sched.h by trying to access runnable_weight field of struct sched_entity in include/linux/sched.h. Please check more details in PR #1510 and #2164. Unfortunately, the runnable_weight field of struct cfs_rq is removed, but the runnable_weight field of struct sched_entity is remained by following patchset series from Linux version 5.7.0. - https://yhbt.net/lore/all/[email protected]/ - https://yhbt.net/lore/all/[email protected]/ Please also check the source of Linux below. - include/linux/sched.h - https://elixir.bootlin.com/linux/v5.7/source/include/linux/sched.h#L475 - kernel/sched/sched.h - https://elixir.bootlin.com/linux/v5.7/source/kernel/sched/sched.h#L502 This PR checks runnable_weight field exists by using kernel_struct_has_field() if target system with BTF enabled, otherwise fallback to legacy on-the-fly compiling check. In the meantime, add Linux version 5.7.0 check in structure definition cfs_rq_partial to prevent issue if target system w/o BTF enabled and Linux version > 5.7. Please check more details in #4602. Signed-off-by: Ism Hong <[email protected]>
captain5050
pushed a commit
to captain5050/bcc
that referenced
this pull request
Oct 12, 2023
runqlen / cpuunclaimed add check_runnable_weight_field() as workaround to check runnable_weight presents in struct cfs_rq in kernel/sched/sched.h by trying to access runnable_weight field of struct sched_entity in include/linux/sched.h. Please check more details in PR iovisor#1510 and iovisor#2164. Unfortunately, the runnable_weight field of struct cfs_rq is removed, but the runnable_weight field of struct sched_entity is remained by following patchset series from Linux version 5.7.0. - https://yhbt.net/lore/all/[email protected]/ - https://yhbt.net/lore/all/[email protected]/ Please also check the source of Linux below. - include/linux/sched.h - https://elixir.bootlin.com/linux/v5.7/source/include/linux/sched.h#L475 - kernel/sched/sched.h - https://elixir.bootlin.com/linux/v5.7/source/kernel/sched/sched.h#L502 This PR checks runnable_weight field exists by using kernel_struct_has_field() if target system with BTF enabled, otherwise fallback to legacy on-the-fly compiling check. In the meantime, add Linux version 5.7.0 check in structure definition cfs_rq_partial to prevent issue if target system w/o BTF enabled and Linux version > 5.7. Please check more details in iovisor#4602. Signed-off-by: Ism Hong <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The following kernel commit changes linux_src:kernel/sched/sched.h
struct cfs_rq structure:
The commit is in kernel 4.15 release and will make current
runqlen.py internal cfs_rq_partial structure not syncing with the kernel one.
As a result, runqlen.py will produce incorrect results on 4.15.
This patch attempts to solve this issue by compiling a bpf program,
which accesses one of fields introduced by the above commit.
The successful compilation will indicate that we should amend
the cfs_rq_partial structure.
Signed-off-by: Yonghong Song [email protected]