From patchwork Tue Mar 14 14:19:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 13174507 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A4F8EC6FD1D for ; Tue, 14 Mar 2023 14:19:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 014E510EA7A; Tue, 14 Mar 2023 14:19:53 +0000 (UTC) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6515C10EA81; Tue, 14 Mar 2023 14:19:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678803587; x=1710339587; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cSI6Q6EbGTpwkXN6+Xoa9wbEHqsQK4X+xOn9dT9cmLs=; b=BFAFR1sbZflgThS3B6XGCtf1LtHWYVknO/PRuMgRx5hYnEI7ZuXQ4Zt4 TXLUpQyb2bhORX/chPqC/ziZ/vt+uYucMeD9Ux0q2LL1aO08YBZBhZqED zQotG7v30y6U35XBGomrLI7Xj9BEFcqWjwAY6NcVAz/nm6SNa15Kl0Mrh fc4K+A9pNGbMWpeI3tkE1dLT16EslSMh4e/2jz7b2qLOujj6lliuQC7EO tUuCbxoR0vO4mPtMv4razKD4HT0MrBN89/+bVTJHbruFD6h1t/Jxa4iGt gAYF6tgmYg5rRBQVS+IK8+MfI7USL8UXACxoYVHJR5T3y13/ORqKuwlHO A==; X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="321284866" X-IronPort-AV: E=Sophos;i="5.98,260,1673942400"; d="scan'208";a="321284866" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Mar 2023 07:19:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="656363286" X-IronPort-AV: E=Sophos;i="5.98,260,1673942400"; d="scan'208";a="656363286" Received: from mjtillin-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.236.227]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Mar 2023 07:19:41 -0700 From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [RFC 07/10] drm/cgroup: Only track clients which are providing drm_cgroup_ops Date: Tue, 14 Mar 2023 14:19:01 +0000 Message-Id: <20230314141904.1210824-8-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230314141904.1210824-1-tvrtko.ursulin@linux.intel.com> References: <20230314141904.1210824-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Clark , Brian Welty , Kenny.Ho@amd.com, Tvrtko Ursulin , Daniel Vetter , Johannes Weiner , linux-kernel@vger.kernel.org, =?utf-8?q?St=C3=A9phane_Marchesin?= , =?utf-8?q?Chris?= =?utf-8?q?tian_K=C3=B6nig?= , Zefan Li , Dave Airlie , Tejun Heo , cgroups@vger.kernel.org, "T . J . Mercier" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Tvrtko Ursulin 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 --- 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;