Re: [PATCH v9 10/15] x86/sgx: Add EPC reclamation in cgroup try_charge()

Haitao Huang
2024-02-23T17:00:37Z

On Fri, 23 Feb 2024 04:18:18 -0600, Huang, Kai <kai.huang@intel.com> wrote:

>> >
>> Right. When code reaches to here, we already passed reclaim per cgroup.
>
> Yes if try_charge() failed we must do pre-cgroup reclaim.
>
>> The cgroup may not at or reach limit but system has run out of physical
>> EPC.
>>
>
> But after try_charge() we can still choose to reclaim from the current
> group,
> but not necessarily have to be global, right? I am not sure whether I am
> missing something, but could you elaborate why we should choose to
> reclaim from
> the global?
>

Once try_charge is done and returns zero that means the cgroup usage is
charged and it's not over usage limit. So you really can't reclaim from
that cgroup if allocation failed. The only thing you can do is to reclaim
globally.

This could happen when the sum of limits of all cgroups is greater than
the physical EPC, i.e., user is overcommitting.

Thanks

Haitao