Skip to content
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

balloons: set frequency scaling governor only when requested #379

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

fmuyassarov
Copy link
Collaborator

Avoid enforcing the frequency scaling governor if the user hasn't explicitly requested it. Previously, we attempted to set it regardless, leading to unnecessary error logs. Furthermore, fix formatting issue when logging error case.

@fmuyassarov
Copy link
Collaborator Author

Thanks @askervin for spotting the bug. PTAL
cc @klihub

klihub
klihub previously approved these changes Oct 10, 2024
@fmuyassarov
Copy link
Collaborator Author

@klihub I have now removed the leftover loop.

@askervin
Copy link
Collaborator

Two nits, otherwise looks good.

@klihub klihub self-requested a review October 11, 2024 07:13
@fmuyassarov fmuyassarov force-pushed the fix-logging branch 2 times, most recently from 5181894 to 3cbc28f Compare October 11, 2024 07:16
@fmuyassarov
Copy link
Collaborator Author

fmuyassarov commented Oct 11, 2024

@klihub addressed the comments. PTAL

@klihub klihub dismissed their stale review October 11, 2024 07:27

Needs a re-review.

klihub
klihub previously approved these changes Oct 11, 2024
@askervin
Copy link
Collaborator

Looking at the governor solution in high level (first implementation and this patch), I'm starting to think that we are adding unnecessary complexity. And I'm slightly worried about it, as we should be adding here other controls as well. If we'd follow the same pattern then, there would be possibly third enforeCpufreqXXX (C-state controls and/or something else) that would needed to be called in the sequence of these two. Currently the two already have different assumption on who is checking if the class exists.

Instead of this complexity and introducing new function --- please tell me if I'm mistaken --- we could add only a single if to the original enforeCpufreq() after checking that the class exists. If governor is defined, then set it to the CPUs, and that's it. We would not need to introduce extra function, or have different error paths.

What do you think, @fmuyassarov and @klihub , could this be stripped down to single "if", which would make much easier to add new controls in the future in the same two-line manner?

@fmuyassarov
Copy link
Collaborator Author

Looking at the governor solution in high level (first implementation and this patch), I'm starting to think that we are adding unnecessary complexity. And I'm slightly worried about it, as we should be adding here other controls as well. If we'd follow the same pattern then, there would be possibly third enforeCpufreqXXX (C-state controls and/or something else) that would needed to be called in the sequence of these two. Currently the two already have different assumption on who is checking if the class exists.

Instead of this complexity and introducing new function --- please tell me if I'm mistaken --- we could add only a single if to the original enforeCpufreq() after checking that the class exists. If governor is defined, then set it to the CPUs, and that's it. We would not need to introduce extra function, or have different error paths.

What do you think, @fmuyassarov and @klihub , could this be stripped down to single "if", which would make much easier to add new controls in the future in the same two-line manner?

I think it makes sense.

@klihub
Copy link
Collaborator

klihub commented Oct 11, 2024

Looking at the governor solution in high level (first implementation and this patch), I'm starting to think that we are adding unnecessary complexity. And I'm slightly worried about it, as we should be adding here other controls as well. If we'd follow the same pattern then, there would be possibly third enforeCpufreqXXX (C-state controls and/or something else) that would needed to be called in the sequence of these two. Currently the two already have different assumption on who is checking if the class exists.

Instead of this complexity and introducing new function --- please tell me if I'm mistaken --- we could add only a single if to the original enforeCpufreq() after checking that the class exists. If governor is defined, then set it to the CPUs, and that's it. We would not need to introduce extra function, or have different error paths.

What do you think, @fmuyassarov and @klihub , could this be stripped down to single "if", which would make much easier to add new controls in the future in the same two-line manner?

Sounds like a really good idea to me. We should consider the governor part of the freq. setting and things get much cleaner.

@klihub klihub dismissed their stale review October 11, 2024 07:57

Let's refactor this based on the latest suggestion by @askervin.

@fmuyassarov
Copy link
Collaborator Author

@askervin @klihub I have refactored the code now. PTAL.

Copy link
Collaborator

@askervin askervin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, we should not introduce a fatal failure due to missing parameters for a CPU class.

pkg/resmgr/control/cpu/cpu.go Outdated Show resolved Hide resolved
@klihub
Copy link
Collaborator

klihub commented Oct 11, 2024

In my opinion, we should not introduce a fatal failure due to missing parameters for a CPU class.

+1. Definitely not.

Avoid enforcing the frequency scaling governor if the user hasn't
explicitly requested it. Previously, we attempted to set it regardless,
leading to unnecessary error logs. Furthermore, fix formatting issue
when logging error case.

Signed-off-by: Feruzjon Muyassarov <feruzjon.muyassarov@intel.com>
@fmuyassarov
Copy link
Collaborator Author

ping @askervin

Copy link
Collaborator

@askervin askervin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks @fmuyassarov!

@askervin askervin merged commit dc2c310 into containers:main Oct 14, 2024
3 checks passed
@fmuyassarov fmuyassarov deleted the fix-logging branch October 14, 2024 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants