Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp860210rwb; Wed, 9 Nov 2022 09:27:52 -0800 (PST) X-Google-Smtp-Source: AMsMyM5AWVRYzYRyM+bkS7SCmfH0K4Ob3FnEXJYsJ5DafaIVB8bD2YIhuutTabBoLUKQHdwgzS90 X-Received: by 2002:a17:906:474b:b0:78d:cea0:e87a with SMTP id j11-20020a170906474b00b0078dcea0e87amr1450047ejs.178.1668014872563; Wed, 09 Nov 2022 09:27:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668014872; cv=none; d=google.com; s=arc-20160816; b=OYuO2sNFb2kdva3MEJ5WmARXGDTNZC8siTHbZE2zHMrdDn5IZoXCHSMe8ZvHiegxHF xPtQZGifN4IosGuscH6QWDu0beIYfjFjJyIgysDhPyvpIjez7LElBhYlhN8SvNCnE0Br CQuoTZd+yYs/NbddrYCvdYQi3pHQMRkG948AbM8FLfX+luj7yHOOxlhjHAiHsDbx4viv 6Ir5pboifGlkKXbp3Lf0S72I0Aip6Qbv2KyIJkAf0awoOUgaEEOxP7QhnWFvrloo4j7y cew5W4slkKAt9cmXywr36sBGjEmWBGu6NK8phM8nkFKdOxsRehehVpyZY4wpQ+f3ZOKF sRuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5BMmq1rhzP5+/n4dRcteCsuqqH1ge9r2cIrgxqEKClM=; b=x8OjhifiCn1Ike2kixHpjy5acddhBBqc51ZSN7KXc6IEogOdTDAq+O9wsxdA/R0q7h rXCy31hke2g2ltVGlbTCE66KnO63t9J4qohQH6Lwrg+F8gRGXGlckiLuS5qwJdK7arHV 1MUM+H6VQIkqoGp/QR8+/9+XVmt4T/2B+DDa7bkGvMn0pEDbw/BDQcjhyV5sjTO2WQLn Ogs/cTVH9n+AN4LRsc3tyQM9l+Gm4VMLvKrOcdbtUU3kgXFqr9QfuBxeQPo+zQkS5uT+ j4vJMHEskP8hEozGQT/1QNemaBstjazcEWydUw++pVCd7XnNoORLf1JVVbHEhTv3z0be R30g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ihKodDpY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz18-20020a1709077d9200b007a2d966eeccsi16772328ejc.686.2022.11.09.09.27.30; Wed, 09 Nov 2022 09:27:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ihKodDpY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232167AbiKIQNG (ORCPT + 92 others); Wed, 9 Nov 2022 11:13:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232151AbiKIQMr (ORCPT ); Wed, 9 Nov 2022 11:12:47 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12C6523E8F; Wed, 9 Nov 2022 08:12:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668010353; x=1699546353; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QhCzUoXOe6qmLG6Pf4Ep1QDjdcywTWaTd4/r+6EDODU=; b=ihKodDpY9JPEmtT4KZOPQXVqfc8u52eY4Ddj70IqK/T6QHn6TEQH+vK5 /BJ1yG/1ouq1dj+V+mzDs+Np7h6kywpP7yTXsmeUCFS+jQItglyyV293T /IV9Zq3no4+zxqkse3llm2cGQ9fldBKBpSHj2FWImpWTxtjAnZ+MWd6pg Unvdith2K+0NRBE/21atjDWiqegXSnaksyLFe4/UT3uoOZw0r93TIvlWi /ULr4CkqNku8VKA0qOQ8CPBXmLfYI1JfTbJmdGv7F0WF7f/k2S7bbo3B9 5gxLfVZK3s8GZhNQz2HCE2krKepwqjXqBTr8JLscdcXs/QaaDROTBhkrt w==; X-IronPort-AV: E=McAfee;i="6500,9779,10526"; a="312181433" X-IronPort-AV: E=Sophos;i="5.96,151,1665471600"; d="scan'208";a="312181433" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2022 08:12:32 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10526"; a="811684566" X-IronPort-AV: E=Sophos;i="5.96,151,1665471600"; d="scan'208";a="811684566" Received: from smurnane-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.196.238]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2022 08:12:27 -0800 From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Tejun Heo , Johannes Weiner , Zefan Li , Dave Airlie , Daniel Vetter , Rob Clark , =?UTF-8?q?St=C3=A9phane=20Marchesin?= , "T . J . Mercier" , Kenny.Ho@amd.com, =?UTF-8?q?Christian=20K=C3=B6nig?= , Brian Welty , Tvrtko Ursulin Subject: [RFC 09/13] drm/cgroup: Only track clients which are providing drm_cgroup_ops Date: Wed, 9 Nov 2022 16:11:37 +0000 Message-Id: <20221109161141.2987173-10-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221109161141.2987173-1-tvrtko.ursulin@linux.intel.com> References: <20221109161141.2987173-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HK_RANDOM_ENVFROM,HK_RANDOM_FROM, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/gpu/drm/drm_cgroup.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/drm_cgroup.c b/drivers/gpu/drm/drm_cgroup.c index e3854741c584..d3050c744e3e 100644 --- a/drivers/gpu/drm/drm_cgroup.c +++ b/drivers/gpu/drm/drm_cgroup.c @@ -35,6 +35,9 @@ void drm_clients_close(struct drm_file *file_priv) lockdep_assert_held(&dev->filelist_mutex); + if (!dev->driver->cg_ops) + return; + pid = rcu_access_pointer(file_priv->pid); clients = xa_load(&drm_pid_clients, (unsigned long)pid); if (WARN_ON_ONCE(!clients)) @@ -66,6 +69,9 @@ int drm_clients_open(struct drm_file *file_priv) lockdep_assert_held(&dev->filelist_mutex); + if (!dev->driver->cg_ops) + return 0; + pid = (unsigned long)rcu_access_pointer(file_priv->pid); clients = xa_load(&drm_pid_clients, pid); if (!clients) { @@ -101,6 +107,9 @@ drm_clients_migrate(struct drm_file *file_priv, lockdep_assert_held(&dev->filelist_mutex); + if (!dev->driver->cg_ops) + return; + existing_clients = xa_load(&drm_pid_clients, new); clients = xa_load(&drm_pid_clients, old); -- 2.34.1