From patchwork Wed Oct 19 17:32:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 5779 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp451261wrs; Wed, 19 Oct 2022 10:36:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5bNsn1cCVgShEDl+sQ8dCqRfgt6G3MtYkXQIh4yF8CGWUqUWKqaG2bTtjmDYkL6iF4JXDK X-Received: by 2002:a17:907:1de1:b0:78d:9919:38cc with SMTP id og33-20020a1709071de100b0078d991938ccmr7617160ejc.311.1666201000200; Wed, 19 Oct 2022 10:36:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666201000; cv=none; d=google.com; s=arc-20160816; b=R986fefdkssiYVW7LxqmMn2J89ZpNQgWLRUOm9yBS92oe/fRZZm1H+lb9AanWmLY55 pTGvW5BFo76dX2waMv0CAjqv5dmjbJBNL37MsNdhpTj+Dl/Ue+kH5X8XhRGNt6ImZRfY xOsp6URwZPVCuIq3Yo6DqF6G/NuFOTdJmsF7zjUY2et6KQaRU3vhyGgmtmip5EQ4oy+I O5iR4z0Ecxu50JkD1pu+IyvMaWEdAQjIUNTYkYLESrcO1JV/zCTFeoWKe7FbxyNgXuly 0blHuoF7ipwR3o/MY+aUodRusnvke90GbLb7ozi4Ou52vycsCAsXcgoTp4yqltLoH/Qq 7psQ== 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=LZlTfHGK3L0tWv+lUGOXIB8Dbuv6fyQW58oFlV4fWeQ=; b=aep2j0D+vtHVmGZCJnEUBzC4LrpAXewiK/QwVL4tPKXAGg2a+9abw6hKr8jizzkLoP B/7LFQOU5v36L73mJu/7u4H1kT86GNGYu1o0Neh3f7fYsdrNTcoH6245DcKXbMOqLTnj IzAYf48GDo8R6tPEq51LELXmCn+EpeWwRPJ668TP9LAoentJRAlxOnJjq+3dsUYBEMNz 46ZDeRlxaO1lB95ZAX05VLUou6Q88ZUIrCNRZ8bj6vGjcmJ77OKDTT08RSq8bbZAmkEf dLNhDIkv8Xcrg6Dv3R1h7NGxRt3ifUWxr8F0On1tw40wwHKQz5WhH8gIFvgGNZ3ciX+p kFHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="jPHY5/x8"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d22-20020a50f696000000b00459fc3fcf0bsi13738684edn.101.2022.10.19.10.36.12; Wed, 19 Oct 2022 10:36:40 -0700 (PDT) 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="jPHY5/x8"; 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 S231311AbiJSReH (ORCPT + 99 others); Wed, 19 Oct 2022 13:34:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231312AbiJSRdt (ORCPT ); Wed, 19 Oct 2022 13:33:49 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52E141D3A76; Wed, 19 Oct 2022 10:33:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666200821; x=1697736821; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lqVOHpteUQeCev/lgNedZY6IzAYCvefhlH9jg3GlMDs=; b=jPHY5/x81a0xSghusQWgWUnxMIGI7eLUovAd9IlxAWf5rqfxRx1xCiI2 RjrUvZSjLoHukW1LCkOV0gvbidoHk0kctR/TEGE+maw5hYYDWPYXTRaXN xNDGBXcv7lHbZj9cSkghu46jEnHPEG899xZCm2jQY+M17Sk5XhwEhlXI/ mYdNUl2d8JptTdxYql1l54S0NsYKBbqasHTjI+bpJyjMuOnIoXMNkQW7w gn/X0pnfX0D5YjEGcvpvTgzBC2XVwNh+Ql+aRff++nfimRWLeBq5nZFmB WnASx8D0asUFzc5Z5/gIJ4FULwnKMA0mKgtpJCG8GX15DlxhARfmxq0W+ A==; X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="306474406" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="306474406" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2022 10:33:39 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="607204754" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="607204754" Received: from mjmcener-mobl1.amr.corp.intel.com (HELO localhost.localdomain) ([10.213.233.40]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2022 10:33:36 -0700 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_Marchesin?= , "T . J . Mercier" , Kenny.Ho@amd.com, =?utf-8?q?Chris?= =?utf-8?q?tian_K=C3=B6nig?= , Brian Welty , Tvrtko Ursulin Subject: [RFC 06/17] drm: Only track clients which are providing drm_cgroup_ops Date: Wed, 19 Oct 2022 18:32:43 +0100 Message-Id: <20221019173254.3361334-7-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221019173254.3361334-1-tvrtko.ursulin@linux.intel.com> References: <20221019173254.3361334-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-5.5 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_HI,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747138379730976849?= X-GMAIL-MSGID: =?utf-8?q?1747138379730976849?= 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/drm_cgroup.c b/drivers/gpu/drm/drm_cgroup.c index 0fbb88f08cef..7ed9c7150cae 100644 --- a/drivers/gpu/drm/drm_cgroup.c +++ b/drivers/gpu/drm/drm_cgroup.c @@ -16,6 +16,9 @@ void drm_clients_close(struct drm_file *file_priv) lockdep_assert_held(&dev->filelist_mutex); + if (!dev->driver->cg_ops) + return; + clients = xa_load(&drm_pid_clients, pid); list_del_rcu(&file_priv->clink); if (atomic_dec_and_test(&clients->num)) { @@ -40,6 +43,9 @@ int drm_clients_open(struct drm_file *file_priv) lockdep_assert_held(&dev->filelist_mutex); + if (!dev->driver->cg_ops) + return 0; + clients = xa_load(&drm_pid_clients, pid); if (!clients) { clients = kmalloc(sizeof(*clients), GFP_KERNEL);