Skip to content

feat: add --force-render-cgroup args to make lxcfs render in view of specific cgroup#696

Open
okhowang wants to merge 1 commit intolxc:mainfrom
okhowang:feat/force-render
Open

feat: add --force-render-cgroup args to make lxcfs render in view of specific cgroup#696
okhowang wants to merge 1 commit intolxc:mainfrom
okhowang:feat/force-render

Conversation

@okhowang
Copy link

it's useful in some complex container hierarchy,
many container work in same parent cgroup for sharing resource (cpu and other)
but need inspect total usage of parent cgroup in single container

@mihalicyn
Copy link
Member

Hi @okhowang,

please, could you sign-off your commit in accordance with our contribution guideline (https://github.com/lxc/lxcfs/blob/main/CONTRIBUTING.md).

Also, please, describe your changes and use case. From what I see in the code, you basically force to always use the same cgroup to take data from.

Kind regards,
Alex

Copy link
Member

@mihalicyn mihalicyn left a comment

Choose a reason for hiding this comment

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

I've left a comment before.

…specific cgroup

Signed-off-by: okhowang(王沛文) <okhowang@tencent.com>
@okhowang
Copy link
Author

okhowang commented Feb 3, 2026

I use --cgroup-parent and --pid to compose multiple container in a unified resource limit and pid namespace, just like a vm.

# setup main.slice cgroup
docker run --cgroup-parent main.slice --name main debian # as main container
docker run --cgroup-parent main.slice --pid container:main --name sidecar debian # as sidecar container 
# and more container

in the pattern containers can see each others, and share same resource.
but if they inspect their resource limit via lxcfs, lxcfs will always render the pid namespace owner's resource (the main containers)

because docker will create a new cgroup in cgroup-parent
e'g main.slice/docker-a.scope main.slice/docker-b.scope and so on.
all containers will get resource view for main.slice/docker-main.scope, because main containers is pid namespace owner.

I want they all got resource view in main.slice

@okhowang okhowang requested a review from mihalicyn March 13, 2026 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants