Message ID | 20230712114605.519432-12-tvrtko.ursulin@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1100232vqm; Wed, 12 Jul 2023 05:08:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlFcoobhO6BYBMKHHt0XxJx3YZgSn9d13RDoKQ8EXDJVTZECAn2637EkxfMeqBocuyLaOebZ X-Received: by 2002:a19:6701:0:b0:4f9:58ed:7bba with SMTP id b1-20020a196701000000b004f958ed7bbamr16519304lfc.16.1689163684559; Wed, 12 Jul 2023 05:08:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689163684; cv=none; d=google.com; s=arc-20160816; b=jBmKYLVc0+zKUQyC/WJUTtV6B+z5n9HupZVf2IccKcPzurN8q3suDEBGrbWscjBlgx VLxCpQAu9hDXnUQtlQnTLBHcl5zibpu0Hd1D1AVWfSMNXoQBO+qQAqv4xMWOZcC9PEZ/ eS40ZTKsHZBzpRzQrdRAneBZ5eftpe39mC/KH1QMBaH3Evj8zLwChAypxPn5+VkmSmie lD+GIaW20V/cJdr2HXEbGuOHLaZ0D3jehgX+hHRhgC4p7Wcg7iK9OS6PfkEOppwqU2Kx +5NFhIudpJb122QPFknmiGLgfc0w9wGJUNr6gmoay5M/LO5acKj3Up60Yi81gJuMcSIl AtUQ== 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=dRCdeEm2VVbLQaD9KfbreUEYl09AWXQJj+bcbyOxgvs=; fh=AB6ahJ7aRRWBRwaRRWg5ebNaiYUkpi/4N4/J23sBvbI=; b=1Ho77g4a2cMLdnlEFpE2C1kgE7RbSb0hiI3U00FYGXPBDpe63ZYH5EbpR1XXyXh9rH RdURg8f73XQNvRZE+bN9lHTJsMw/rdkmSvgE2veknEz9eQq9lo2+n5+ir4Qx9cf23V1e rjo1kbEJKktS/68YOBHobV1cEieN+qdOA+MGlJBG15pyuONHHL0V2z2nWd3qW8NjSrC9 QgBzTNP9E7cyp815WEAD+Ezx/BN6i0h0TyLRJBHYsbPvvQJ0PHEmu9lSStFXOob614Ws i8Luae1kp7p9ruMY+hEVWAkAAzf5u4XCQ9KmXC1x8BdGcWXNRNY//f3LLJIyaMPqGA+b eHXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FGQusYvy; 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 a14-20020a50ff0e000000b0051dece5afcesi4172636edu.225.2023.07.12.05.07.40; Wed, 12 Jul 2023 05:08:04 -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=FGQusYvy; 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 S233553AbjGLLuq (ORCPT <rfc822;gnulinuxfreebsd@gmail.com> + 99 others); Wed, 12 Jul 2023 07:50:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233534AbjGLLua (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 12 Jul 2023 07:50:30 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F13971BC0; Wed, 12 Jul 2023 04:48:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689162540; x=1720698540; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lKoMcXbN2L6Bp1UujVMkXfxYLgXbZyOn20AweTGZa3U=; b=FGQusYvyooIBMdm94c+Zt2bU4Hz1aq/sRc7UwSPKwcn45hCPJkJe24qo e87qKL8L6OwjpZqGoLE8I4f89jfVc/lwqzREUocGcG3n1mLAzSCCAv+E5 Nqki4YADqxuG5jyrrchowgt8uW+ubZY9LfevgCiLwu4LeYUyNHvFF7/tM hPFyvIMRhbphTAY7gVVQj5/KJfR8nUbgq7+oXqUMBkb9GVSg8OrpvKwKM UW1XRoonDqK87bezXXZnorL8vmglCeSrbb5zARrKUdZbymWjQ9z4bDb62 PD53dqx8FwtKBgKBwlQacQPs1ydC4GwHdMa2UH/KPw+SKYX7JxZTqNE2Q A==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="344469303" X-IronPort-AV: E=Sophos;i="6.01,199,1684825200"; d="scan'208";a="344469303" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2023 04:46:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="866094136" X-IronPort-AV: E=Sophos;i="6.01,199,1684825200"; d="scan'208";a="866094136" Received: from eamonnob-mobl1.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.237.202]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2023 04:46:54 -0700 From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> To: Intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>, Johannes Weiner <hannes@cmpxchg.org>, Zefan Li <lizefan.x@bytedance.com>, Dave Airlie <airlied@redhat.com>, Daniel Vetter <daniel.vetter@ffwll.ch>, Rob Clark <robdclark@chromium.org>, =?utf-8?q?St=C3=A9phane_Marchesin?= <marcheu@chromium.org>, "T . J . Mercier" <tjmercier@google.com>, Kenny.Ho@amd.com, =?utf-8?q?Chris?= =?utf-8?q?tian_K=C3=B6nig?= <christian.koenig@amd.com>, Brian Welty <brian.welty@intel.com>, Tvrtko Ursulin <tvrtko.ursulin@intel.com> Subject: [PATCH 11/17] drm/cgroup: Only track clients which are providing drm_cgroup_ops Date: Wed, 12 Jul 2023 12:45:59 +0100 Message-Id: <20230712114605.519432-12-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230712114605.519432-1-tvrtko.ursulin@linux.intel.com> References: <20230712114605.519432-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 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_BLOCKED,SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771216499504173692 X-GMAIL-MSGID: 1771216499504173692 |
Series |
DRM cgroup controller with scheduling control and memory stats
|
|
Commit Message
Tvrtko Ursulin
July 12, 2023, 11:45 a.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> 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 <tvrtko.ursulin@intel.com> --- 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;