clarification about misc controller and capacity vs. max
Hi there,
I notice in the comments for the misc controller it is stated that the max limit can be more than actual total capacity, meaning that we can overcommit with the resource controlled by the misc controller. However, in the misc_cg_try_charge() code, the function will return - EBUSY if max limit will be crossed or total usage will be more than the capacity, which would seem to enforce total capacity as an upper limit in addition to max and not allow for overcommit. Can you provide some clarity on whether the resource consumption model for the misc controller should allow for overcommit?
Thanks,
Kristen Accardi
A message that is not in the archive (sent off-list or not yet received): 2f7b7d6b10bdcbc9a73ea449d3636575124afa25.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Hello,
Quoted 9 lines · Kristen C
I notice in the comments for the misc controller it is stated that the max limit can be more than actual total capacity, meaning that we can overcommit with the resource controlled by the misc controller. However, in the
misc_cg_try_charge()code, the function will return - EBUSY if max limit will be crossed or total usage will be more than the capacity, which would seem to enforce total capacity as an upper limit in addition to max and not allow for overcommit. Can you provide some clarity on whether the resource consumption model for the misc controller should allow for overcommit?
I think what it's trying to say is that the sum of first level .max's can be higher than the total capacity. e.g. Let's say you have 5 of this resource and a hierarchy like the following.
R - A - A'
+ B - B'
\ CIt's valid to have A, B, C's max set to 4, 3, 2 respectively even if they sum up to 9 which is larger than what's available in the system, 5 - ie. the max limits are overcommitted for the resource.
Thanks.
Signature · 1 line
tejun
A message that is not in the archive (sent off-list or not yet received): Y2FPSqOaQGnISvXu-NiLfg/[email protected]
Quoted 29 lines · On Tue, 2022-11-01 at 06:54 -1000, [email protected] wrote:
Hello,
Quoted 7 lines · Kristen C
I notice in the comments for the misc controller it is stated that the
max limit can be more than actual total capacity, meaning that we can
overcommit with the resource controlled by the misc controller. However, in themisc_cg_try_charge()code, the function will return -Quoted 8 lines
EBUSY if max limit will be crossed or total usage will be more than the
capacity, which would seem to enforce total capacity as an upper limit
in addition to max and not allow for overcommit. Can you provide some
clarity on whether the resource consumption model for the misc controller should allow for overcommit?I think what it's trying to say is that the sum of first level .max's can be
higher than the total capacity. e.g. Let's say you have 5 of this resource
and a hierarchy like the following.R - A - A'
+ B - B'
\ C
Quoted 8 lines
It's valid to have A, B, C's max set to 4, 3, 2 respectively even if they
sum up to 9 which is larger than what's available in the system, 5 - ie. the
max limits are overcommitted for the resource.Thanks.
So to be clear, if I have this:
/sys/fs/cgroup/misc.capacitysome_res 10
and this:/sys/fs/cgroup/test
test.current will never be allowed to exceed 10.
A message that is not in the archive (sent off-list or not yet received): 14c21f13ebbcdbd0ea4f75b7fff790b31a05a5aa.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Quoted 9 lines · Kristen C
So to be clear, if I have this:
/sys/fs/cgroup/misc.capacitysome_res10and this:
/sys/fs/cgroup/testtest.current will never be allowed to exceed 10.
Yes, but test.max can be whatever. So, the resources themselves can't be over-committed. The max limits (ie. the promises) can be.
Thanks.
Signature · 1 line
tejun
A message that is not in the archive (sent off-list or not yet received): Y2FR6SYazbxyK5nj-NiLfg/[email protected]
Quoted 9 lines · On Tue, 2022-11-01 at 07:05 -1000, [email protected] wrote:
Quoted 8 lines · Kristen C
So to be clear, if I have this:
/sys/fs/cgroup/misc.capacitysome_res10and this:
/sys/fs/cgroup/test
Quoted 8 lines
Quoted 1 line
test.current will never be allowed to exceed 10.
Yes, but test.max can be whatever. So, the resources themselves can't be
over-committed. The max limits (ie. the promises) can be.Thanks.
This is a bit of a deal breaker for the use of the misc controller for SGX EPC memory - we allow overcommit of the physical EPC memory as we have backing RAM that is used to swap. Would you be amenable to having a flag to ignore the total capacity value and allow for overcommit of the resource? If not I feel like we don't have a choice but to create a new controller.
A message that is not in the archive (sent off-list or not yet received): f678f325b47ac64e101c0ccea54c1cd1c4ea4206.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Quoted 6 lines · Kristen C
This is a bit of a deal breaker for the use of the misc controller for SGX EPC memory - we allow overcommit of the physical EPC memory as we have backing RAM that is used to swap. Would you be amenable to having a flag to ignore the total capacity value and allow for overcommit of the resource? If not I feel like we don't have a choice but to create a new controller.
Yeah, for sure. Maybe just introduce a special value (prolly u64 max) that says that there's no limit. Or maybe just set it to total physical memory?
Thanks.
Signature · 1 line
tejun
Hello.
Quoted 9 lines · Kristen C
So to be clear, if I have this:
/sys/fs/cgroup/misc.capacitysome_res10and this:
/sys/fs/cgroup/testtest.current will never be allowed to exceed 10.
If the capacity was initially larger than 10 and charges inside test succeeded and then some event caused shrinking of the resource (without synchronously preempting distributed units), then test.misc.current can exceed the current capacity.
See the condition in misc_cg_current_show()
if (READ_ONCE(misc_res_capacity[i]) || usage)
What the shrinking and preemption means is up to the implementation of the particular miscresource.
IOW sum of 1st level children's .current may overrun capacity, semantics is not defined by the misc controller (but it'd reject new charges in such a situation).
(That's just for completeness. I understood from the rest that you rather want to disable capacity checking.)
HTH,
Michal