Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8745490rwp; Wed, 19 Jul 2023 14:53:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlE/V4WpY3fL/ycJW0kYN0388Y3LfBlZS7rewMn+o+Dj3eYR+8pILhTTDD11MxDq/UXtJael X-Received: by 2002:a17:90a:108f:b0:264:91:4acc with SMTP id c15-20020a17090a108f00b0026400914accmr2974545pja.11.1689803594379; Wed, 19 Jul 2023 14:53:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689803594; cv=none; d=google.com; s=arc-20160816; b=yJeNfAJNNtsrfDV6z20VBQp9JxIILluJcaXFRl5Xz6B9NgE7G9/c6c+pkvP7V2NDgW ezRvjUYIHQIVNHx2jMkHVFeT9pAhkppALED1RUS+u1X0hruN1hedHn5VgGVbsc5gBDz4 H1Cv5WA/xr7uAwI+sIWwdlKFkzIsxywgH93DKgEJ7XwTTGCPweKBn15PrWjdFXZ2ulNB Y6yqoJfY0gg95bURaVoz8bP+B/BmlLDs/KDZnbDCOVei6gs0xbIdgtQQE4I5D1OKpUyT pl4WQwcdv7KO2FWPxp37mDu38GWVbSdnHaJ+A/fW1Z0CrHVgYsTRL2RKZxXRKsjW1OXm 5pKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=hVa5fBSVAdHHhZFj/pRkL4ALpTE995mDIMsnkkRTm0Q=; fh=noQc5fLvUow7xwhcpc24bVtoVgSXBAilP4qISFpexlU=; b=BwP1xwfojx0N/cR4h/wY+ycN7O/Rfi7KRnNvZXY/uKfzXX/xemXk1Q+gDOdVHiVn7c Vuj5NzGDfrYUYYsmQDdpvNFHCSsBeQK6WkmomTx1g7fUi1IYaJhTDRlMG5xvKLKjlLqo yijg2PNY8pg7wH6hJXDIdLkaVp9PzF7+PwrgJbHj83WWEi4SG5d5xEesUEEF6ogQBXKl evEnxBGJs2v2O1relupmlxx81Jsmy+/2z2FH4Ftl+FpgG9HDGXE4Fs9/mZpLRGBistOo xXx28o/3Duq1vKWEoF5im88a3AU3iX/SFtKcLvejcAB4OYFcGxmfzIRfGhQuLcZeEtHn J2Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=Lde5n1cK; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n10-20020a17090a9f0a00b00263dcd605a9si2102198pjp.25.2023.07.19.14.53.02; Wed, 19 Jul 2023 14:53:14 -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=@google.com header.s=20221208 header.b=Lde5n1cK; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229952AbjGSUda (ORCPT + 99 others); Wed, 19 Jul 2023 16:33:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231316AbjGSUd0 (ORCPT ); Wed, 19 Jul 2023 16:33:26 -0400 Received: from mail-oo1-xc30.google.com (mail-oo1-xc30.google.com [IPv6:2607:f8b0:4864:20::c30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05FB9210E for ; Wed, 19 Jul 2023 13:33:05 -0700 (PDT) Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-5658573b1faso92683eaf.1 for ; Wed, 19 Jul 2023 13:33:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689798726; x=1692390726; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=hVa5fBSVAdHHhZFj/pRkL4ALpTE995mDIMsnkkRTm0Q=; b=Lde5n1cKOA1T4bKffkRp7OCLFw3kIzNszFORWjdILVZqUjkjtj/r9hJnWetWPtfHma ljuFtQpXVY4jecYQAp9auj6671m4eJtWAWASvcxJ0vh6TBOL3L3JPhny0qmlkfIO9s+W 8B9dU1kPuZnzPVLrgJf4wHRzdb2yDbMwGZLSaAOSX8ifu+zNVAZ4k00aAjhvtL71UYFE zBzIW5qzWajLb4R1YlKHx0jzIA1FhXb9NOCMhsidexUSwl+9zzaHMeWSsIwt4d/UKdn3 ou8P9mOiEJewUTZVMKvwVKWKgZcn3ZknSYuePQSkjSIgj6WoH4BvzHG+o4ET6ZkJEN1+ idEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689798726; x=1692390726; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hVa5fBSVAdHHhZFj/pRkL4ALpTE995mDIMsnkkRTm0Q=; b=FOIEcAWe3lRHPs/EHsXZYEQpAZnT2T/j3PV0IPoKXe/pzBH+0IOpU3jfu0WwMx0NdJ M6EqQcc9Y2qH7tuCOKikGu+aKX1V2+Kx8f7CQMPWZ+D+gTHOWjinPAsEuu/chrbUKAQh zv62AybE/fd4JU269TmW5e47fcYAv+HEiG0gg5gjmR4eZ3sS+hMAz2Voq2S8ioEb3jwk ba8S1kkoicst/ixfKXkvDV2nikX+0z/pSsuJ9BG9ZKz7j9MtHYf0XeAgbnv+krcBHi/y oRoihSYcDI3rSR7eov6wmQbxFxcMRulPImzHpH3FhLrFOoos6/9z0/cHnfQVv2yz3u+S GsaQ== X-Gm-Message-State: ABy/qLaZ2WlAEfRgbKYwWQjqDNvHwKeQpG7Ik468hyignc+7I6wU1iuY IngCa21APHRakZzcZpW45UINm6QwrsrLBmN2csrfpQ== X-Received: by 2002:a05:6808:138c:b0:3a3:eab8:8710 with SMTP id c12-20020a056808138c00b003a3eab88710mr4242718oiw.43.1689798726160; Wed, 19 Jul 2023 13:32:06 -0700 (PDT) MIME-Version: 1.0 References: <20230712114605.519432-1-tvrtko.ursulin@linux.intel.com> In-Reply-To: <20230712114605.519432-1-tvrtko.ursulin@linux.intel.com> From: "T.J. Mercier" Date: Wed, 19 Jul 2023 13:31:54 -0700 Message-ID: Subject: Re: [RFC v5 00/17] DRM cgroup controller with scheduling control and memory stats To: Tvrtko Ursulin Cc: Intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, 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?= , Kenny.Ho@amd.com, =?UTF-8?Q?Christian_K=C3=B6nig?= , Brian Welty , Tvrtko Ursulin , Eero Tamminen Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 On Wed, Jul 12, 2023 at 4:47=E2=80=AFAM Tvrtko Ursulin wrote: > > drm.memory.stat > A nested file containing cumulative memory statistics for the who= le > sub-hierarchy, broken down into separate GPUs and separate memory > regions supported by the latter. > > For example:: > > $ cat drm.memory.stat > card0 region=3Dsystem total=3D12898304 shared=3D0 active=3D0 re= sident=3D12111872 purgeable=3D167936 > card0 region=3Dstolen-system total=3D0 shared=3D0 active=3D0 re= sident=3D0 purgeable=3D0 > > Card designation corresponds to the DRM device names and multiple= line > entries can be present per card. > > Memory region names should be expected to be driver specific with= the > exception of 'system' which is standardised and applicable for GP= Us > which can operate on system memory buffers. > > Sub-keys 'resident' and 'purgeable' are optional. > > Per category region usage is reported in bytes. > > * Feedback from people interested in drm.active_us and drm.memory.stat i= s > required to understand the use cases and their usefulness (of the fiel= ds). > > Memory stats are something which was easy to add to my series, since I= was > already working on the fdinfo memory stats patches, but the question i= s how > useful it is. > Hi Tvrtko, I think this style of driver-defined categories for reporting of memory could potentially allow us to eliminate the GPU memory tracking tracepoint used on Android (gpu_mem_total). This would involve reading drm.memory.stat at the root cgroup (I see it's currently disabled on the root), which means traversing the whole cgroup tree under the cgroup lock to generate the values on-demand. This would be done rarely, but I still wonder what the cost of that would turn out to be. The drm_memory_stats categories in the output don't seem like a big value-add for this use-case, but no real objection to them being there. I know it's called the DRM cgroup controller, but it'd be nice if there were a way to make the mem tracking part work for any driver that wishes to participate as many of our devices don't use a DRM driver. But making that work doesn't look like it would fit very cleanly into this controller, so I'll just shut up now. Thanks! -T.J.