-
Notifications
You must be signed in to change notification settings - Fork 169
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
Avoid unnecessary inter-processor interrupts by checking that writes are necessary #622
Conversation
Print the name of the file being read instead of its descriptor.
We can use `read_file` and `write_to_file` to handle all manipulation of sysctl parameters. This does not change the behavior of _read_sysctl and _write_sysctl, but it alters some of their debug/error messages.
4cf17a0
to
36e1f0b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR. I'm wondering why do we need a new option for this and why this is not a default? cc @MarSik
Edit: Sorry, my bad. Looking at the code this seems fine. I thought we're adding a new option to tuned-main.conf
Thank you for the PR, @zacikpa . Testing this right now. So far, I've noticed the following issues. When the same value is in the governor, we still write the same value. The
will have to be changed to
so that we take advantage of this new functionality. Anyways, could you please look into the |
Also, running
causes quite a few IPIs. This is pretty "expensive" if we're just checking that |
I've finished testing the code. In summary, I see these issues that I'd like to see fixed before merging:
Issues that I do not expected fixed by this PR:
As even reading
can cause IPIs, this change could essentially make things worse IPI-wise when writing a different value of EPB/EPP. The first IPI would happen during the read, the second during the write. I wonder if it would make sense to exclude the diff_check (set it FWIW, reads/writes to EPP seem to be "expensive" in mostly the same way, whereas reads of EPB are less expensive than writes to EPB. |
Hello @jmencak. I updated the PR so that:
Regarding the reads: if reading EPP is as expensive as writing, then I'd say it doesn't make sense to check the value first. |
@jmencak Regarding the aliases for EPB: can you please open a separate upstream or Jira issue for that? |
Thank you for the changes, Pavol. Great work! The code now does what I expect it to do. After testing, I can only see IPIs caused by the following options:
At this point this is expected and hard to avoid/work around. The code changes look sane to me, but deferring to other reviewers for comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, the code LGTM. I have two minor comments that aren't blockers and could be handled later. I think this PR needs to be merged into FDP and we have still some time to fine tune it, so I will keep it open for now.
In some situations it may be desirable to check if a file write is necessary by comparing the new file content with the existing one (e.g., when the write always causes an inter-processor interrupt). This commit adds an option to perform such a check in `write_to_file`. If it succeeds, the write is skipped.
Resolves: RHEL-25613
If the CPU supports hwp_epp, we should always be able to access EPB via its sysfs knob, so we don't have to check if we have x86_energy_perf_policy because we don't need it to manipulate EPB.
I've retested with the latest code, still looks good. |
This PR adds a new option
check_diff
to the functioncommands.write_to_file
. When set toTrue
, the function checks whether the current value is equal to the one being written - if it is, the write is skipped.The new option is disabled by default, but I enable it for plugin options where the write may cause an inter-processor interrupt even when the value does not change.