What is "docker_optimizations" in dietpiEnv.txt and why not?

In the file “dietpiEnv.txt” there is a variable which is by default “docker_optimizations=off” and I am wondering what it does and why one would want to leave it off or turn it on, what disadvantages there would be to having those optimizations on.

Searching the DietPi Docs (DietPi Documentation - DietPi.com Docs) currently gives no result for “docker_optimizations” and neither does searching Development and Programming Software Options - DietPi.com Docs for the same.

Based on this Best path to a custom kernel on arm? - #8 by multiblitz post it at least at that time set “cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1” at boot, but what disadvantages would there be to having those on?
Are there more things changed by that variable and if so, same query regarding those too.

Thank you!

@MichaIng Are you able to answer this question? My guess is that it has nothing to do with DietPi scripts, but rather with certain kernel functions on certain boards.

1 Like

You can see the effect of this flag here: DietPi/.build/images/U-Boot/boot.cmd at 02592a3c0a9b33d851a5b71390c9a6571287c355 · MichaIng/DietPi · GitHub

It enables the memory control group, Docker is adding itself to, which allows controlling and monitoring the amount of memory containers are allowed to use. Without this, Docker will throw some warnings on startup, other container engines even deny to start up. swapaccount=1 enables support for controlling swap space usage as well, basically completing memory usage control.

I just see that swapaccount has been deprecated with Linux 6.1, and older Armbian builds have this enabled by default already. Hence this is a noop and can be removed: mm: memcontrol: deprecate swapaccounting=0 mode · torvalds/linux@b25806d · GitHub

Probably the memory cgroup is in the meantime enabled OOTB as well. Theoretically, having those enabled means a tiny performance regression, hence they are/were not enabled OOTB. They are however enabled automatically, when you install any container engine via dietpi-software.

cgroup_memory=1 was an ancient RPi-only setting, replaced by cgroup_enable=memory, and has no effect anymore since years. No idea why this is still floating around. I am wondering about the cpuset control group. IIRC, on Armbian kernel, it was enabled OOTB, but on my RPi Zero W it is not enabled OOTB. But even that we do not actively enable it on container engine installs, those do not fail.

1 Like

Aha.
Thank you very much for the detailed answer, @MichaIng!
It seems to me that setting in that file pretty much is pointless then, except in some extreme edge cases where those users would know to enable the specific flags that they need anyway.
Good to know. :slight_smile:

Using Docker or other container engines is not such an extreme edge case. But as long as you do not use it, and no other software you use fails or complains to require the memory control group, there is no point to enable it, indeed.

Of course. I meant that since

the scenarios where one would have a good reason to turn it on manually would be few.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.