public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: "Rob Clark" <robdclark@chromium.org>,
	Kenny.Ho@amd.com, "Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	linux-kernel@vger.kernel.org,
	"Stéphane Marchesin" <marcheu@chromium.org>,
	"Christian König" <christian.koenig@amd.com>,
	"Zefan Li" <lizefan.x@bytedance.com>,
	"Dave Airlie" <airlied@redhat.com>, "Tejun Heo" <tj@kernel.org>,
	cgroups@vger.kernel.org, "T . J . Mercier" <tjmercier@google.com>
Subject: [RFC 07/10] drm/cgroup: Only track clients which are providing drm_cgroup_ops
Date: Tue, 14 Mar 2023 14:19:01 +0000	[thread overview]
Message-ID: <20230314141904.1210824-8-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20230314141904.1210824-1-tvrtko.ursulin@linux.intel.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

To reduce the number of tracking going on, especially with drivers which
will not support any sort of control from the drm cgroup controller side,
lets express the funcionality as opt-in and use the presence of
drm_cgroup_ops as activation criteria.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 kernel/cgroup/drm.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/kernel/cgroup/drm.c b/kernel/cgroup/drm.c
index 68f31797c4f0..60e1f3861576 100644
--- a/kernel/cgroup/drm.c
+++ b/kernel/cgroup/drm.c
@@ -97,6 +97,9 @@ void drmcgroup_client_open(struct drm_file *file_priv)
 {
 	struct drm_cgroup_state *drmcs;
 
+	if (!file_priv->minor->dev->driver->cg_ops)
+		return;
+
 	drmcs = css_to_drmcs(task_get_css(current, drm_cgrp_id));
 
 	mutex_lock(&drmcg_mutex);
@@ -112,6 +115,9 @@ void drmcgroup_client_close(struct drm_file *file_priv)
 
 	drmcs = css_to_drmcs(file_priv->__css);
 
+	if (!file_priv->minor->dev->driver->cg_ops)
+		return;
+
 	mutex_lock(&drmcg_mutex);
 	list_del(&file_priv->clink);
 	file_priv->__css = NULL;
@@ -126,6 +132,9 @@ void drmcgroup_client_migrate(struct drm_file *file_priv)
 	struct drm_cgroup_state *src, *dst;
 	struct cgroup_subsys_state *old;
 
+	if (!file_priv->minor->dev->driver->cg_ops)
+		return;
+
 	mutex_lock(&drmcg_mutex);
 
 	old = file_priv->__css;
-- 
2.37.2


  parent reply	other threads:[~2023-03-14 14:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-14 14:18 [RFC v4 00/10] DRM scheduling cgroup controller Tvrtko Ursulin
2023-03-14 14:18 ` [RFC 01/10] drm: Track clients by tgid and not tid Tvrtko Ursulin
2023-03-14 15:33   ` Christian König
2023-03-15  9:52     ` Tvrtko Ursulin
2023-03-15 13:19       ` Christian König
2023-03-14 14:18 ` [RFC 02/10] drm: Update file owner during use Tvrtko Ursulin
2023-03-14 15:49   ` Christian König
     [not found]   ` <20230314141904.1210824-3-tvrtko.ursulin-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2023-04-21 12:13     ` Emil Velikov
2023-06-08 14:26       ` Tvrtko Ursulin
2023-06-20 14:48         ` Emil Velikov
2023-03-14 14:18 ` [RFC 03/10] cgroup: Add the DRM cgroup controller Tvrtko Ursulin
2023-03-14 14:18 ` [RFC 04/10] drm/cgroup: Track DRM clients per cgroup Tvrtko Ursulin
2023-03-14 14:18 ` [RFC 05/10] drm/cgroup: Add ability to query drm cgroup GPU time Tvrtko Ursulin
2023-03-14 14:19 ` [RFC 06/10] drm/cgroup: Add over budget signalling callback Tvrtko Ursulin
2023-03-14 14:19 ` Tvrtko Ursulin [this message]
2023-03-14 14:19 ` [RFC 08/10] cgroup/drm: Introduce weight based drm cgroup control Tvrtko Ursulin
2023-03-14 14:19 ` [RFC 09/10] drm/i915: Wire up with drm controller GPU time query Tvrtko Ursulin
2023-03-14 14:19 ` [RFC 10/10] drm/i915: Implement cgroup controller over budget throttling Tvrtko Ursulin
     [not found] ` <20230314141904.1210824-1-tvrtko.ursulin-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2023-03-25  1:43   ` [RFC v4 00/10] DRM scheduling cgroup controller Tejun Heo

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=20230314141904.1210824-8-tvrtko.ursulin@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=Kenny.Ho@amd.com \
    --cc=airlied@redhat.com \
    --cc=cgroups@vger.kernel.org \
    --cc=christian.koenig@amd.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=marcheu@chromium.org \
    --cc=robdclark@chromium.org \
    --cc=tj@kernel.org \
    --cc=tjmercier@google.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