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

Michal Koutný mkoutny at suse.com
Wed Feb 7 15:28:24 UTC 2024


Hello.

On Tue, Oct 24, 2023 at 05:07:20PM +0100, Tvrtko Ursulin <tvrtko.ursulin at linux.intel.com> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20240207/17b0619c/attachment-0001.sig>


More information about the dri-devel mailing list