Skip to content

Comments

core/unit: fix resource usage message when the unit stops#33145

Closed
michaelolbrich wants to merge 1 commit intosystemd:mainfrom
michaelolbrich:resource
Closed

core/unit: fix resource usage message when the unit stops#33145
michaelolbrich wants to merge 1 commit intosystemd:mainfrom
michaelolbrich:resource

Conversation

@michaelolbrich
Copy link
Contributor

@michaelolbrich michaelolbrich commented Jun 1, 2024

The log message with the used CPU time, memory, etc. is currently not shown because the cgroup data is destroy before the message is created.

Call unit_log_resources() before unit_prune_cgroup() to fix this.

The log message with the used CPU time, memory, etc. is currently not
shown because the cgroup data is destroy before the message is created.

Call unit_log_resources() before unit_prune_cgroup() to fix this.
@github-actions github-actions bot added the please-review PR is ready for (re-)review by a maintainer label Jun 1, 2024
@github-actions
Copy link

github-actions bot commented Jun 1, 2024

Important

An -rc1 tag has been created and a release is being prepared, so please note that PRs introducing new features and APIs will be held back until the new version has been released.

Copy link
Member

@YHNdnzj YHNdnzj left a comment

Choose a reason for hiding this comment

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

No. unit_log_resources uses values cached by unit_prune_cgroup, so the current order is correct. Also, we really should log about them after the cgroup has been destroyed, making sure that the peak values are accurate. Hence I'm not convinced.

If you have a specific problem, please describe it so that we can come up with a proper fix.

@YHNdnzj YHNdnzj added pid1 needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer and removed please-review PR is ready for (re-)review by a maintainer labels Jun 1, 2024
@michaelolbrich
Copy link
Contributor Author

See #33149.

@michaelolbrich
Copy link
Contributor Author

The CGroupRuntime struct managing the cgroup contains the cached values. So if logging first is not acceptable, and the cgroup must be removed first, then either the struct must stay around after the cgroup is removed or the cached values need to go elsewhere.

@YHNdnzj
Copy link
Member

YHNdnzj commented Jun 1, 2024

The cached values aren't only for logging. Previously we also show them after the cgroup/unit terminates. Hence this is indeed something we should fix, but the approach is not feasible.

@YHNdnzj YHNdnzj added reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks and removed needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer labels Jun 1, 2024
YHNdnzj added a commit to YHNdnzj/systemd that referenced this pull request Jun 9, 2024
YHNdnzj added a commit to YHNdnzj/systemd that referenced this pull request Jun 9, 2024
YHNdnzj added a commit to YHNdnzj/systemd that referenced this pull request Jun 9, 2024
@github-actions github-actions bot removed the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Jun 13, 2024
YHNdnzj added a commit to YHNdnzj/systemd that referenced this pull request Jun 15, 2024
YHNdnzj added a commit to YHNdnzj/systemd that referenced this pull request Jun 15, 2024
YHNdnzj added a commit to YHNdnzj/systemd that referenced this pull request Jun 19, 2024
intelfx pushed a commit to intelfx/systemd that referenced this pull request Jun 22, 2024
YHNdnzj added a commit to YHNdnzj/systemd that referenced this pull request Jun 28, 2024
daandemeyer pushed a commit to daandemeyer/systemd that referenced this pull request Jul 19, 2024
bluca pushed a commit that referenced this pull request Jul 19, 2024
intelfx pushed a commit to intelfx/systemd that referenced this pull request Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants