Re: [RFC 1/8] cgroup: Add the DRM cgroup controller

From: Michal Koutný
Date: Wed Feb 07 2024 - 10:28:40 EST


Hello.

On Tue, Oct 24, 2023 at 05:07:20PM +0100, Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxxxxxxxx> wrote:
> +struct drm_cgroup_state {
> + struct cgroup_subsys_state css;
> +};
> +
> +struct drm_root_cgroup_state {
> + struct drm_cgroup_state drmcs;
> +};
> +
> +static struct drm_root_cgroup_state root_drmcs;

Special struct type for root state is uncommon.
Have
struct drm_cgroup_state root_drmcs;
and possible future members can be global state variables.


> +static void drmcs_free(struct cgroup_subsys_state *css)
> +{
> + struct drm_cgroup_state *drmcs = css_to_drmcs(css);
> +
> + if (drmcs != &root_drmcs.drmcs)
> + kfree(drmcs);
> +}

I think it can be relied on root cgroup not being ever free'd by cgroup
core.

Michal

Attachment: signature.asc
Description: PGP signature