[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <op.2g3q0ve0wjvjmi@hhuan26-mobl.amr.corp.intel.com>
Date: Fri, 05 Jan 2024 19:42:21 -0600
From: "Haitao Huang" <haitao.huang@...ux.intel.com>
To: Michal Koutný <mkoutny@...e.com>
Cc: jarkko@...nel.org, dave.hansen@...ux.intel.com, tj@...nel.org,
linux-kernel@...r.kernel.org, linux-sgx@...r.kernel.org, x86@...nel.org,
cgroups@...r.kernel.org, tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
hpa@...or.com, sohil.mehta@...el.com, zhiquan1.li@...el.com,
kristen@...ux.intel.com, seanjc@...gle.com, zhanb@...rosoft.com,
anakrish@...rosoft.com, mikko.ylinen@...ux.intel.com, yangjie@...rosoft.com
Subject: Re: [PATCH v6 01/12] cgroup/misc: Add per resource callbacks for CSS
events
On Fri, 05 Jan 2024 03:45:02 -0600, Michal Koutný <mkoutny@...e.com> wrote:
> On Mon, Oct 30, 2023 at 11:20:02AM -0700, Haitao Huang
> <haitao.huang@...ux.intel.com> wrote:
>> From: Kristen Carlson Accardi <kristen@...ux.intel.com>
>>
>> The misc cgroup controller (subsystem) currently does not perform
>> resource type specific action for Cgroups Subsystem State (CSS) events:
>> the 'css_alloc' event when a cgroup is created and the 'css_free' event
>> when a cgroup is destroyed.
>>
>> Define callbacks for those events and allow resource providers to
>> register the callbacks per resource type as needed. This will be
>> utilized later by the EPC misc cgroup support implemented in the SGX
>> driver.
>
> I notice now that the callbacks are per resource and per cgroup.
> I think that is an overkill that complicates misc_cg allocation code
> with parent's callbacks while freeing is done by own callbacks.
> It's possibly too much liberal to keep objects' lifecycle understandable
> in the long term too.
>
> For some uniformity, I'd suggest struct blkcg_policy array in
> block/blk-cgroup.c as the precedent. (Perhaps indexed with static enum
> misc_res_type instead of dynamic index assignment as
> blkcg_policy_registeer() does.)
>
> I hope you don't really need per-cgroup callbacks :-)
>
> Michal
Sure I can do that. IIUC, you are suggesting something similar how
capacity is set via misc_cg_set_capacity for each resource type. Here we
make a misc_cg_set_ops() which stores the ops pointers in a static array,
then use them indexed with the resource type.
Thanks
Haitao
Powered by blists - more mailing lists