The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: chenridong <chenridong@huawei.com>
To: Haitao Huang <haitao.huang@linux.intel.com>, <jarkko@kernel.org>,
	<dave.hansen@linux.intel.com>, <kai.huang@intel.com>,
	<tj@kernel.org>, <mkoutny@suse.com>,
	<linux-kernel@vger.kernel.org>, <linux-sgx@vger.kernel.org>,
	<x86@kernel.org>, <cgroups@vger.kernel.org>, <tglx@linutronix.de>,
	<mingo@redhat.com>, <bp@alien8.de>, <hpa@zytor.com>,
	<sohil.mehta@intel.com>, <tim.c.chen@linux.intel.com>
Cc: <zhiquan1.li@intel.com>, <kristen@linux.intel.com>,
	<seanjc@google.com>, <zhanb@microsoft.com>,
	<anakrish@microsoft.com>, <mikko.ylinen@linux.intel.com>,
	<yangjie@microsoft.com>, <chrisyan@microsoft.com>
Subject: Re: [PATCH v14 02/14] cgroup/misc: Add per resource callbacks for CSS events
Date: Fri, 7 Jun 2024 09:53:11 +0800	[thread overview]
Message-ID: <683e88d8-aa34-40c0-a8d5-d7f8f9d4deee@huawei.com> (raw)
In-Reply-To: <op.2ox8wt11wjvjmi@hhuan26-mobl.amr.corp.intel.com>

I think it is better when _misc_cg_res_alloc fails, it just calls 
_misc_cg_res_free(cg, index)(add index parameter, it means ending of 
iterator), so it can avoid calling ->free() that do not call ->alloc().

And in misc_cg_free, just call _misc_cg_res_free(cg, MISC_CG_RES_TYPES)  
to free all.


Thanks

Ridong


On 2024/6/6 22:51, Haitao Huang wrote:
> On Thu, 06 Jun 2024 08:37:31 -0500, chenridong <chenridong@huawei.com> 
> wrote:
>
>>
>>   If _misc_cg_res_alloc fails, maybe some types do not call 
>> ->alloc(), but all types ->free() callback >will be called, is that ok?
>>
> Not sure I understand. Are you suggesting we ignore failures from 
> ->alloc() callback in _misc_cg_res_alloc() as it is per-resource, and 
> have ->free() callback and resource provider of the failing type to 
> handle the failure internally?
>
> IIUC, this failure only happens when a specific subcgroup is created 
> (memory running out for allocation) so failing that subcgroup as a 
> whole seems fine to me. Note the root node is static and no 
> pre-resource callbacks invoked by misc. And resource provider handles 
> its own allocations for root. In SGX case we too declare a static 
> object for corresponding root sgx_cgroup struct.
>
> Note also misc cgroup (except for setting capacity[res] = 0 at root) 
> is all or nothing so no mechanism to tell user "this resource does not 
> work but others are fine in this particular cgroup."
>
> Thanks
> Haitao
>

  reply	other threads:[~2024-06-07  1:53 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-31 22:26 [PATCH v14 00/14] Add Cgroup support for SGX EPC memory Haitao Huang
2024-05-31 22:26 ` [PATCH v14 01/14] x86/sgx: Replace boolean parameters with enums Haitao Huang
2024-05-31 22:26 ` [PATCH v14 02/14] cgroup/misc: Add per resource callbacks for CSS events Haitao Huang
     [not found]   ` <eeb1f936-2989-4de0-8353-b2373ce47474@huawei.com>
2024-06-06 14:51     ` Haitao Huang
2024-06-07  1:53       ` chenridong [this message]
2024-06-07 14:23         ` Haitao Huang
2024-05-31 22:26 ` [PATCH v14 03/14] cgroup/misc: Export APIs for SGX driver Haitao Huang
2024-05-31 22:26 ` [PATCH v14 04/14] cgroup/misc: Add SGX EPC resource type Haitao Huang
2024-05-31 22:26 ` [PATCH v14 05/14] x86/sgx: Implement basic EPC misc cgroup functionality Haitao Huang
2024-05-31 22:26 ` [PATCH v14 06/14] x86/sgx: Add sgx_epc_lru_list to encapsulate LRU list Haitao Huang
2024-05-31 22:26 ` [PATCH v14 07/14] x86/sgx: Abstract tracking reclaimable pages in LRU Haitao Huang
2024-05-31 22:26 ` [PATCH v14 08/14] x86/sgx: Add basic EPC reclamation flow for cgroup Haitao Huang
2024-05-31 22:26 ` [PATCH v14 09/14] x86/sgx: Abstract check for global reclaimable pages Haitao Huang
2024-05-31 22:26 ` [PATCH v14 10/14] x86/sgx: Implement async reclamation for cgroup Haitao Huang
2024-05-31 22:26 ` [PATCH v14 11/14] x86/sgx: Charge mem_cgroup for per-cgroup reclamation Haitao Huang
2024-05-31 22:26 ` [PATCH v14 12/14] x86/sgx: Turn on per-cgroup EPC reclamation Haitao Huang
2024-05-31 22:26 ` [PATCH v14 13/14] Docs/x86/sgx: Add description for cgroup support Haitao Huang
2024-05-31 22:26 ` [PATCH v14 14/14] selftests/sgx: Add scripts for EPC cgroup testing Haitao Huang
2024-06-04 22:00   ` Jarkko Sakkinen
2024-06-05 15:33     ` Haitao Huang
2024-06-05 22:30       ` Huang, Kai
2024-06-06  6:20         ` Jarkko Sakkinen
2024-06-06  6:23           ` Jarkko Sakkinen
2024-06-06  5:32       ` Jarkko Sakkinen
2024-06-06 13:13         ` Haitao Huang
2024-06-10 22:39           ` Huang, Kai
2024-06-11 12:57             ` Haitao Huang
2024-06-11 21:56               ` Huang, Kai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=683e88d8-aa34-40c0-a8d5-d7f8f9d4deee@huawei.com \
    --to=chenridong@huawei.com \
    --cc=anakrish@microsoft.com \
    --cc=bp@alien8.de \
    --cc=cgroups@vger.kernel.org \
    --cc=chrisyan@microsoft.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=haitao.huang@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jarkko@kernel.org \
    --cc=kai.huang@intel.com \
    --cc=kristen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=mikko.ylinen@linux.intel.com \
    --cc=mingo@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=seanjc@google.com \
    --cc=sohil.mehta@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tim.c.chen@linux.intel.com \
    --cc=tj@kernel.org \
    --cc=x86@kernel.org \
    --cc=yangjie@microsoft.com \
    --cc=zhanb@microsoft.com \
    --cc=zhiquan1.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox