Proposed fix for cgroups mounting

When supervisor is starting up it asks the following questions:

is /sys/fs/cgroup mounted with with a device name of "cgroupsRoot"
for each ["cpu,cpuacct", "memory", "freezer"] as subsys
    is /sys/fs/cgroup/<subsys> mounted with a device name of <subsys>

If any of those tests fail then Legato mounts the required cgroups itself.

All of this is fine, except that it is following an odd convention that can’t be depended on. Certainly on our AGL-derived build this is not quite the way those directories are mounted.

It doesn’t really matter what the device names are. What matters is the location and type of file system. Here is my mod to do just that.

is /sys/fs/cgroup mounted with with a fs type of "tmpfs"
for each ["cpu,cpuacct", "memory", "freezer"] as subsys
    is /sys/fs/cgroup/<subsys> mounted with a fs type of "cgroup"

I guess you could go the extra mile and test the options the fs was mounted with, and make sure “memory” was mounted as a cgroup with the option “memory”. But who would do something so intentionally confusing?

Here’s my changes:

CGroup fix commit

I missed an instance of “tmpfs”, and I’ve updated my code on github. The new commit range is:

If it makes it easier for Sierra, I can sync my fork up with legatoproject’s, then cherry-pick my commits to a convenient branch. I can even submit a pull request. Just tell me how you prefer it.

Hi @cholmes ,

thanks for your contribution, and sorry we are not able to process it as efficiently as we would like.
I am working with some colleagues on a contribution process based on GitHub and an external Gerrit instance to distribute some proprietary content that SWI cannot distribute through GitHub.

We would ideally like to accept GitHub PR contributions but that might not be the case initially.

If you do not mind waiting for next week, we should have a workingish contribution process through that external Gerrit instance and it would be great for us if you could provide your changes through this process (as to debug things, and also to have your feedback about the whole experience).

Would that work for you?


I’m in no hurry. Count me in when you’re ready.

work is still on going,
keep you inform when it will be available.
best regards,

Hi @cholmes, @plu - could someone please re-post the patch? We are faced with similar issues but the code disappeared.
It would be great to make Legato future-proof for cgroup v2 compatibility…

I am no longer working with Legato, and I deleted that repo. So the code no longer exists.

It isn’t a difficult change to make on your own, however. Find the code in supervisor that tests the cgroups, and instead of testing the device names you want to test the filesystem types.

thanks for your quick reply - meanwhile, I figured this out as well :smile:

Meanwhile, I put this and some other changes on along with some hackish fixes to make everything compile against a standalone yocto-sdk