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

[hostcfgd] Enhance hostcfgd to check feature state and run less system calls #7987

Merged
merged 2 commits into from
Jul 4, 2021
Merged

[hostcfgd] Enhance hostcfgd to check feature state and run less system calls #7987

merged 2 commits into from
Jul 4, 2021

Conversation

shlomibitton
Copy link
Contributor

@shlomibitton shlomibitton commented Jun 27, 2021

Signed-off-by: Shlomi Bitton shlomibi@nvidia.com

Why I did it

Currently hostcfgd is implemented in a way each feature which is enabled/disabled triggering execution of systemctl enable/unmask commands which eventually trigger 'systemctl daemon-reload' command.
Each call like this cost 0.6s and overall add a overhead of ~12 seconds of CPU time.
This change will verify the desired state of a feature and the current state of this feature on systemd and trigger a system call only when must.

How I did it

Check each feature status on systemd before executing a system call to enable and reload the systemctl daemon.

How to verify it

Build an image with this change and observe less system calls are executed.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106

Description for the changelog

A picture of a cute animal (not mandatory but encouraged)

jleveque
jleveque previously approved these changes Jun 28, 2021
kcudnik
kcudnik previously approved these changes Jun 28, 2021
…cuting a system call.

Adapt the unit tests to the new change.
Add another UT to verify daemon behavior when no system calls are required.

Signed-off-by: Shlomi Bitton <shlomibi@nvidia.com>
@shlomibitton shlomibitton dismissed stale reviews from kcudnik and jleveque via dab7b96 June 30, 2021 14:29
@shlomibitton shlomibitton requested review from jleveque and kcudnik June 30, 2021 14:29
jleveque
jleveque previously approved these changes Jun 30, 2021
kcudnik
kcudnik previously approved these changes Jun 30, 2021
@yxieca yxieca merged commit d99595a into sonic-net:master Jul 4, 2021
@qiluo-msft
Copy link
Collaborator

This PR could not be cleanly cherry-picked to 202012. Please submit another PR.

stepanblyschak added a commit to stepanblyschak/sonic-buildimage that referenced this pull request Jul 9, 2021
@shlomibitton shlomibitton deleted the shlomi_hostcfgd_enhance branch July 20, 2021 08:52
judyjoseph pushed a commit that referenced this pull request Aug 4, 2021
…m calls (#7987)

Why I did it
Currently hostcfgd is implemented in a way each feature which is enabled/disabled triggering execution of systemctl enable/unmask commands which eventually trigger 'systemctl daemon-reload' command.
Each call like this cost 0.6s and overall add a overhead of ~12 seconds of CPU time.
This change will verify the desired state of a feature and the current state of this feature on systemd and trigger a system call only when must.

How I did it
Check each feature status on systemd before executing a system call to enable and reload the systemctl daemon.

How to verify it
Build an image with this change and observe less system calls are executed.

Signed-off-by: Shlomi Bitton <shlomibi@nvidia.com>
carl-nokia pushed a commit to carl-nokia/sonic-buildimage that referenced this pull request Aug 7, 2021
…m calls (sonic-net#7987)

Why I did it
Currently hostcfgd is implemented in a way each feature which is enabled/disabled triggering execution of systemctl enable/unmask commands which eventually trigger 'systemctl daemon-reload' command.
Each call like this cost 0.6s and overall add a overhead of ~12 seconds of CPU time.
This change will verify the desired state of a feature and the current state of this feature on systemd and trigger a system call only when must.

How I did it
Check each feature status on systemd before executing a system call to enable and reload the systemctl daemon.

How to verify it
Build an image with this change and observe less system calls are executed.

Signed-off-by: Shlomi Bitton <shlomibi@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants