Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp645481rwb; Thu, 12 Jan 2023 10:23:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXvUY2Yz4NZlmIJ/Zqst50qZCHyZqHD5CLdhKineiMlrI2ZitwS3ebHRK/UPZZO/mYX5vIen X-Received: by 2002:a17:902:d292:b0:18f:aa25:46d with SMTP id t18-20020a170902d29200b0018faa25046dmr7191728plc.38.1673547798279; Thu, 12 Jan 2023 10:23:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673547798; cv=none; d=google.com; s=arc-20160816; b=MpW0vzH29JdVzKegeLoPUQPl2q+taAgyGoWch2RqHtF6Q/4Bf/rJoWKaYbvNwmeV6o iWvijUgBm+1C5GvxloWWA1Rjoz9+eJ0ET0X6R0hzznergfTkgahRAbq19473O7Yw14QI 4ZCUzaMNyncsN9xX/CuE9iI8vJei0j5sS/qDxxLE/kdq4wAWb0IMbcIV7vHrd/ck8ijA 0QsyKTDy4B9PsNe623pcyDULOsbSwjoX5OGgRwdOQ/+KzQZpcNZKMSOvomrlSQBwhgGQ BLbBqwurqCi7UrxR2gPAKUDeb2yYQmeK3RQKdkHPzB2s2NceHyDiNSRCmifHD9lKg6Pw fVOQ== 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=nG9WZpkf41ISNMVUpox8dRUQJQT8l192M1pL4x33Fks=; b=nP+8s/62lfnUZhHsscLEoSoqenYNmeBBTcI3RM7n4nNRUaKkCn4W7KDPnhzBIa9+Yj TbEgV+4p+lNpOKgivx6rMa/iZ2g20lbsSV/S1WRVf6bNEBiOtzMAoAkAr0lrjqG+JBBX yz3/EL8qVydLuVJFqJe2/+cNo+Hbmof6YSCjORml8/SoL4aBL6LmDeFduWwHot/sa4nH gm2ETLNOolalioARg0+Ekto/wXzmbcJ0SKhYjYf5+Jha3DlxnA0v4AwnWx+XrcV5CD+f o7+SbRO4CmwGI0SDDjncvjXssmjftsJqW7LnWmvHSGMU0VOubcNceRVDcrljFWJWai6B iyLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UvOK29aw; 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 t13-20020a170902e84d00b001944c51f9d6si5449314plg.123.2023.01.12.10.23.11; Thu, 12 Jan 2023 10:23:18 -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=UvOK29aw; 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 S233223AbjALRhl (ORCPT + 50 others); Thu, 12 Jan 2023 12:37:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232875AbjALRgx (ORCPT ); Thu, 12 Jan 2023 12:36:53 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA560CBBC9; Thu, 12 Jan 2023 08:58:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673542685; x=1705078685; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=O4XaQU0KHXm7hstqYZ0YTz10nkjZFCF6V51/eW89DXg=; b=UvOK29aweZah2HmcgZ4TU4AIluBFTxEUwOIi927JbKEuIQH8AWQFlDdb hSlzWWNtEjLGGbrqgAGRzRRIVcX7TNicW9/aF8xBGeQOVTSGsQj9Q4YUL MzOEO2rxDsrKsU2eKXV8mfMq3f7n0phwIWkD3taqTWgHS8Cwj4ByXPj4S 6R3dmSV0wexEI5skjJmBxplMybxosTpMovBVXQq8r7ejIFRPsA3spkGti KSgJ2QsbWrRxF0Ea0VzRBod0O/TH1SUMEQoTXAY0mFWaV8x7lW3NeoFhi MCZVlrsTCMB+Aw4zvPtdiKfqgBVZ0TiOLMh5xmLKa7ZEXECXTOntiLqLw Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="325016536" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="325016536" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:57:02 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="651232885" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="651232885" Received: from jacton-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.195.171]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:56:54 -0800 From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org, dri-devel@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 08/12] drm/cgroup: Only track clients which are providing drm_cgroup_ops Date: Thu, 12 Jan 2023 16:56:05 +0000 Message-Id: <20230112165609.1083270-9-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112165609.1083270-1-tvrtko.ursulin@linux.intel.com> References: <20230112165609.1083270-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.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 ef951421bba6..09249f795af3 100644 --- a/drivers/gpu/drm/drm_cgroup.c +++ b/drivers/gpu/drm/drm_cgroup.c @@ -36,6 +36,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 (drm_WARN_ON_ONCE(dev, !clients)) @@ -67,6 +70,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) { @@ -102,6 +108,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, (unsigned long)new); clients = xa_load(&drm_pid_clients, (unsigned long)old); -- 2.34.1