-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Cgroups: check for cpuset.cpus before set the value #254
Conversation
Here comes the example: Assume I have 4 CPUs in my host, at the very beginning everything is OK for
Then I put CPU1 off and then put it on
Let's check for the cpuset.cpus of cgroup docker
And then run that docker CLI again, error happen
This is because when we shut down CPU1, the cgroup system update all the sub-cgroup system about the cpuset.cpus. But when the CPU1 comes back it didn't do the same thing. |
Assume we put some CPUs offline and then bring them online again, since there is not a mechanism that to help docker to refresh the state of CPUs, all the following containers will never use those off-and-on CPUs again. So we should always check whether there has already a change of CPUs before we set it to the container. Signed-off-by: Hu Keping <hukeping@huawei.com>
I don't think it's a bug. For cgroup, it's reasonable that cgroup updates cpuset.cpus of all sub-cgroups when some CPUs are offline, because they are not available. And it's also reasonable that cgroup didn't do the same thing when CPUs come back, because cgroup don't know if these cpuset.cpus are assigned by user or changed by cgroup (except root cgroup, it should always enable all cpus). So I think it's intended. Ping @lizf-os (kernel cgroup and cpuset maintainer), can you confirm that? So the same reason, a Docker container can't expend cpuset.cpus for it's parent, because Docker don't know if it's assigned by user or changed by CPU offline. |
Isn't it wired that all the CPUs are available but |
It is wired in your scenario, but think about another scenario, if I set I think the solution would be on kernel side, let kernel record every movement for cpuset.cpus changes, if they are changed by cgroup itself when CPUs are shutdown, and never changed before CPUs are up again, then cgroup should change these cpuset.cpus back. Not sure if that's worth doing. |
The Besides, even if you set the
What if we turn CPU1 off and then on? All the follow containers will never have a chance to use CPU1 again. |
This is a long-standing issue, but it has been fixed, but only if you use unified hierarchy, which hasn't been supported by docker or any distro. |
Thanks @lizf-os but I am more care about the capability of |
Yes, this is the usage, and I know a lot of people use in this way (before Docker support this usage by itself).
That'll be a problem, but there is nothing you can do on Docker side, your PR would break things as I said before. As @lizf-os said, it's fixed in kernel but only for unified hierarchy, don't know why this can't be fixed for mutil hierarchy? |
Because we don't want people stick with legacy hierarchies forever, so all new developments have been done for unified hierarchy only. |
Ya, i'm not sure if this is a problem we can solve at this level. |
Yep, this should be solved at a higher level. |
Fix golint warnings
Assume we put some CPUs offline and then bring them online again, since
there is not a mechanism that to help docker to refresh the state of CPUs,
all the following containers will never use those off-and-on CPUs again.
So we should always check whether there has already a change of CPUs before
we set it to the container.
Signed-off-by: Hu Keping hukeping@huawei.com