Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A question on the design of cgroup.cpu_cfs_util #1622

Open
rayx opened this issue Jan 3, 2019 · 5 comments
Open

A question on the design of cgroup.cpu_cfs_util #1622

rayx opened this issue Jan 3, 2019 · 5 comments

Comments

@rayx
Copy link
Contributor

rayx commented Jan 3, 2019

I have looked at the test code, and have a doubt on the test's design.

If I understand it correctly, the test creates VMs and put the vcpu threads of these VMs into cgroups so that they can use as much as the max capability of all host cpus. Then it starts a number of while-loops in each VM to use up that capability. Then it checks if the cpu time used by guest is close to that used by host.

My question is about the setup. The test sets up cgroups to allow VMs use up all host cpu cores (implementation details: assuming host has 40 cores, the test creates VMs with total number of 80 vcpus, and allow each vcpu thread to use 0.5 core in term of cpu time. So in total it allows these VMs to use all cpu time on the host). From my understanding, when one verifies cgroup setup, one should check the actual resource usage doesn't exceed the limit. In this case, however, since the limit is the entire host cpu time, I wonder how it can be checked? Or let me put it this way, if we remove the cgroup setup in this test, the test would still have same result, doesn't it? (I think so, thought I didn't verify it).

In my opinion, the test should be changed to set up cgroups to allow all VMs can use, say, 50% of host cpu time. Then run workload (eg., the while-loop) in VMs and check it doesn't exceed the limit by using the data in /proc/stat.

@xiangchunfu
Copy link
Contributor

When booting a VM, avacodo-vt framework used only 1/2 all host cpu cores. It doesn't appear vcpu overcommit for single VM.

@rayx
Copy link
Contributor Author

rayx commented Jan 5, 2019

@xiangchunfu Sorry, I don't get what you meant. How does it relate to my original post? Can you elaborate it a bit?

@xiangchunfu
Copy link
Contributor

@rayx I tested this case, As the test allow VMs use twice host cpu cores. so it is a special case. In general, avacodo-vt framework just allow VM to use 1/2 all host cpu cores. so please ignore my comments above. In my understanding, Currently the test code doesn't check single vcpu if exceed the limit, It only check the entire host cpu limit. You want to change this design so that can confirm per vcpu if exceed limit, right?

@rayx
Copy link
Contributor Author

rayx commented Jan 8, 2019

@xiangchunfu No, that's not what I meant. I meant the way how cgroup is tested is fundamentally flawed in cpu_cfs_util test. Let me put it in another way. Suppose you have a process (it can be any process on host, not necessarily QEMU) and you want to test cpu.cfg_period_us and cpu.cfs_quota_us work with this process. Will you set up these two parameters to allow the process use 100% of all cpu cores on the host? You won't, because if so how would you check the setup actually works?

I think the test makes the same mistake.

@xiangchunfu
Copy link
Contributor

@rayx You are right. we should control vcpu number = physical cpu number(shouldn't be overcommit) when booting qemu(or other any) process. then stress vcpu usage to 100%. then check qemu process cpu usage in host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants