Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1465936rwi; Wed, 19 Oct 2022 10:55:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7TqIeBL5LQCdCStpCVc5nyvrT6CSVK1wQdGGyM+/jsWx4elve6Vf6z8i36psa4oaWPG0J5 X-Received: by 2002:a17:907:2d0b:b0:78e:674:6b32 with SMTP id gs11-20020a1709072d0b00b0078e06746b32mr7719515ejc.226.1666202143255; Wed, 19 Oct 2022 10:55:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666202143; cv=none; d=google.com; s=arc-20160816; b=ZU6x/mu575aFFIoiTkswkwm6R9OaiyziqNKvpDK6HkZ//n2kZ809/8C0M8+iefnYKd B626xd3irlRW7eYCnhO5N8b6Q4KBCVZomTe+8h1KDtJLPt3+leE/wut9Ibso7cX/L3zo Xk0JGaMu5wz5SOziyfKvVw6p8YwaF2OGQSlnj0ny4yfFN18tKMXVHbg6j/pRdudPqVKN 9lnwbJaWdGi1bQKUV95h7WEzsW9FvY8sQWIW9ziTOpYZied348GyCIEak1DmaiO7pujM tz2ahN2AqzcUeykjg1q9m54INXbAtFzJ1cnQxtDpUN11eIeWtLY4p8wtYPTw3Mi/1nFt 7qOA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g11-20020a056402090b00b00457053aadeasi18177888edz.398.2022.10.19.10.55.17; Wed, 19 Oct 2022 10:55:43 -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=20Marchesin?= , "T . J . Mercier" , Kenny.Ho@amd.com, =?UTF-8?q?Christian=20K=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 Content-Transfer-Encoding: 8bit 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 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); -- 2.34.1