core/cgroup: various fixes for accounting#33258
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
2750516 to
41a562b
Compare
|
cc @michaelolbrich @HeRaNO Could you please give this PR a test? |
I'm so sorry that recently I won't have much time working on this. I will give it a test when I have time, maybe within next two weeks. |
41a562b to
23795ea
Compare
23795ea to
8db3cb4
Compare
|
I'm working on testing today but I didn't manage to run a testing qemu with mkosi (24~devel). The terminal quits unexpectedly quite often (on Ubuntu 24.04) and wastes me a lot of time. Please ignore me if you're sure that the issue is solved. I'm trying hard to start the testing qemu. T T |
|
Works as expected now. |
Can you open an issue on the mkosi repository with what you are seeing? Note that apparmor is broken on ubuntu and will need to be disabled to run mkosi with a swtpm as is done in the systemd repo. |
Hi. I mainly follow the guide on Hacking on systemd. But I'm afraid I can't provide useful information for you because the terminal just disappeared while running the steps (also I'm not clear on what step the terminal disappeared. Thing I can only do is open another terminal and rerun the build). Here are my environment and steps:
I'm afraid the problem is with me because I didn't disable Apparmor (only doing workarounds). Please point them out if I've made any other mistakes. Thanks. |
|
@poettering Could you please take a look? Currently the accounting output for |
|
It would seem that systemd-run v256, even with this merged, no longer prints IP traffic stats even when |
| if (r < 0) | ||
| return log_unit_debug_errno(u, r, "Failed to determine whether cgroup %s is empty, ignoring: %m", empty_to_root(crt->cgroup_path)); | ||
|
|
||
| log_unit_debug_errno(u, r, "Failed to determine whether cgroup %s is empty: %m", empty_to_root(crt->cgroup_path)); |
There was a problem hiding this comment.
I liked the , ignoring suffix. In general I like that systemd tries to always tell what is its reaction to any error condition that's happening; might make sense to keep it or there's something I'm missing?
There was a problem hiding this comment.
But here the error isn't ignored, as we return it anyway. Also I doubt that ", ignoring" here really tells you anything?
There was a problem hiding this comment.
Yes, it's an unfortunate bleed-through of semantics from the function's (only?) caller. It is moderately useful, though, as it tells me that as a result of this error, an action will be skipped, the system will continue to function, but with some cruft potentially left over.
I have never encountered this exact error, but similar error messages in the past were quite helpful. I'm mainly administering "pets", not "cattle" though, so I might be slightly biased.
Indeed. Will update the patch, |
8db3cb4 to
052ba23
Compare
|
@intelfx Could you test IP accounting again? |
|
@YHNdnzj yup, can confirm it works for me, thanks! |
keszybz
left a comment
There was a problem hiding this comment.
LGTM. The code is complicated… so it's hard to say that all the changes are correct, but just looking at the patches, it looks all good, and the reports from testing are also good.
…r freezer The same check is used everywhere else.
No functional change, just deduplicate default values in cgroup_runtime_free() and remove pointless call in unit_free() (at the time it's called the CGRuntime has been destroyed already).
Since the introduction of CGroupRuntime, there's no need to call *_reset_accounting in unit_new(), hence make those static. While at it, refrain from hardcoding default values in cgroup_runtime_new(), but call the corresponding funcs. This also corrects the default value of io_accounting_base. Fixes systemd#33482
If cgroup is already gone, i.e. CGRuntime.cgroup_path is NULL, do not return -ENODATA prematurely, but check for cached values first. For systemd#33149
Currently, unit_setup_cgroup_runtime() is called in various _coldplug() functions if the unit is not inactive. That seems unnecessary though, and kinda defeats the purpose of CGroupRuntime. If we need to fork off a process for the unit or got something during deserialization, the CGroupRuntime would be automatically set up by unit_prepare_exec() / cgroup_runtime_deserialize_one(). Otherwise it would mean the cgroup doesn't exist and we don't need to allocate that in the first place. Plus, note that socket units might also carry a cgroup with ExecStartPre=/ExecStartPost=/... Hence the existing code is really inconsistent.
052ba23 to
f26b2ec
Compare
|
I backported the 2nd, 4th, 6th, 7th, 8th and 10th commits |
Fixes #33149
Replaces #33145
Closes #33145