Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3066143rdb; Wed, 13 Sep 2023 00:22:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE26gJoaXYmGB4u9kDAcP0ZgYAuOjoPGIOmdYohvIumOmH7QVlZJFm8Xxm/ht74ZOMvL2qy X-Received: by 2002:a05:6358:99a3:b0:134:c4dc:2c4e with SMTP id j35-20020a05635899a300b00134c4dc2c4emr1566337rwb.23.1694589731149; Wed, 13 Sep 2023 00:22:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694589731; cv=none; d=google.com; s=arc-20160816; b=MqKVQ0AurSEhK1AUgwRwFUlIMQn8DdjWjz1Cy9+YqzBfHeLGBQrtjjH8eJ/R6t0iSj IS/pxyEhAczEhVneadD3MzLVL8G0qVsbQhQqzPF+mCCRSnOInhNEzaXTKsPv/bjhz2T4 Qa4Avk2Brj/V3wHcLej2zgFKZmfuR+dJiIrTn8xYJnPAEUETHvwEz26BvG6c3sDEqi6p 53pyVv7ZFBnucm8beq5+VnajBXWi8MG+JD9spjI2EqUGKRq20LVL/cRtOUigP7gsjHK7 h44b1Qse/8EoVttpxD41F/lWMfkQVmicbvJPTvhMW3CLqFLY9UUVWReH1WnHVIR4LdW7 deSg== 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=Q7tdcZxWcWP9Umyb5qLqi3mZy8phtG7cbzdtVA/Y3II=; fh=WVwj2bTZnsaXf+XyntfaPJI6y/DZYfJar8oDIlWIXug=; b=0Xcz3vraj6ORYq3T/nwCXRRWwz4OFWn9uUSR4LhFBXDr9x01G88ZJZ5k8Y5//d1/we zErHYoT6WeO/Z4ZRIMxpGzENwS4R03c2REbjV7pnQ/JsQmphVEmvoeoQCDxU1+6GU37Y whPo27GoWGGity7YwMRA9Jnv+f/rNMsFAW3NnK/MlFfIBrXBj2UZaNDCxTmiKR1LbOXD D2cyynnqaE53Uo5Xxok6vGnHwFd57BYIqoKwwKZTIRJsax7+qvWFZST56RpvZ1kPj156 fVZcOjv7WXIw3R53+l0srCmodq4YXbY9L59nhWtXucM+wTwBqQscw+x25vm/PZd1GPnq N/hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=UP3EsIGh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id m4-20020a633f04000000b00565610b2ed5si9358765pga.794.2023.09.13.00.22.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 00:22:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=UP3EsIGh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 9B0ED824E517; Tue, 12 Sep 2023 19:14:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229543AbjIMCO4 (ORCPT + 99 others); Tue, 12 Sep 2023 22:14:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231138AbjIMCOy (ORCPT ); Tue, 12 Sep 2023 22:14:54 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE598170A; Tue, 12 Sep 2023 19:14:49 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-99c93638322so97058366b.1; Tue, 12 Sep 2023 19:14:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694571288; x=1695176088; darn=vger.kernel.org; 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=Q7tdcZxWcWP9Umyb5qLqi3mZy8phtG7cbzdtVA/Y3II=; b=UP3EsIGhZ9ZIpe6Gq6afCOcMfI4urcqFNc7a+jO3f1CWT4viA9pMNc4bhH/wmHs7RY Tayf/ClY1ddRKFkRTGmXtHmSdGdayLC20XMfZ+Zty8ujDPMXxiO8XBnZy9BTt7gW5BOh 2YW7jMhqoHDqDupyt0wbs+BpmTO1WlfV656cWEhzgW1u58CRxoOBJImH1tOcZEPAnN92 Zj9a+J8l6+15fkO/rIxURnf8GO2E12cddRWLIRT9FEOwIEp/eLGSJdqYTtujoPdD7ywv hCL+Qdu7v44A7JQ5aU4Etb+4kZStLsMLMIs8sNANRnQe99YYH/Dgpzy3P+b1f5w4TKUX /4/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694571288; x=1695176088; 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=Q7tdcZxWcWP9Umyb5qLqi3mZy8phtG7cbzdtVA/Y3II=; b=lf6QdD/WF9OjgX9s+G0xtwTzXW4vZrdXThe0p+MvD2hBOtzZejpIGsl8FcQmT5p6Z3 e2iDRi0FxCZ/O4leOXiu4jDwE9CSpYiPbHrCw+vMKQhWDbLwNAiZmnFyT5RAVi0UEyrn chOMUdYsDfOo/jc+gd5dDKtaVJGmnG6hTb1+KkebhWrWlFt5NAyX5xEWinM/1UYrAzFd 5rmbbQMwcA93PyXcHO9QUWj6WBkS5f+7DUoU4EXVXn4QhyhEY5E728NmkOuwISng9oB6 ZrT/i8c+KYlYgerV1kxDEAonVOTi5vc98S3hipiIGfIW+bpa1V6gRCAR+GdASl8RoSJG R1nA== X-Gm-Message-State: AOJu0YxZ2gwgr2MygeMU36tw6+yhHahmGK8xyhZRZbhSxUiVy1yp69wt pmA0qgCd48bqgH1zGPYOkm2NRWt88gLO7uQ7jIQ= X-Received: by 2002:a17:907:762d:b0:9a5:9305:83fb with SMTP id jy13-20020a170907762d00b009a5930583fbmr1793419ejc.34.1694571287818; Tue, 12 Sep 2023 19:14:47 -0700 (PDT) MIME-Version: 1.0 References: <20230912084044.955864-1-adrian.larumbe@collabora.com> <20230912084044.955864-7-adrian.larumbe@collabora.com> <20230912113210.65897aab@collabora.com> In-Reply-To: From: Rob Clark Date: Tue, 12 Sep 2023 19:14:35 -0700 Message-ID: Subject: Re: [PATCH v4 6/6] drm/drm-file: Show finer-grained BO sizes in drm_show_memory_stats To: Boris Brezillon Cc: =?UTF-8?Q?Adri=C3=A1n_Larumbe?= , maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch, quic_abhinavk@quicinc.com, dmitry.baryshkov@linaro.org, sean@poorly.run, marijn.suijten@somainline.org, robh@kernel.org, steven.price@arm.com, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, healych@amazon.com, kernel@collabora.com, freedreno@lists.freedesktop.org, Tvrtko Ursulin Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 12 Sep 2023 19:14:56 -0700 (PDT) X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email On Tue, Sep 12, 2023 at 6:46=E2=80=AFPM Rob Clark wro= te: > > On Tue, Sep 12, 2023 at 2:32=E2=80=AFAM Boris Brezillon > wrote: > > > > On Tue, 12 Sep 2023 09:37:00 +0100 > > Adri=C3=A1n Larumbe wrote: > > > > > The current implementation will try to pick the highest available siz= e > > > display unit as soon as the BO size exceeds that of the previous > > > multiplier. That can lead to loss of precision in BO's whose size is > > > not a multiple of a MiB. > > > > > > Fix it by changing the unit selection criteria. > > > > > > For much bigger BO's, their size will naturally be aligned on somethi= ng > > > bigger than a 4 KiB page, so in practice it is very unlikely their di= splay > > > unit would default to KiB. > > > > Let's wait for Rob's opinion on this. > > This would mean that if you have SZ_1G + SZ_1K worth of buffers, you'd > report the result in KiB.. which seems like overkill to me, esp given > that the result is just a snapshot in time of a figure that > realistically is dynamic. > > Maybe if you have SZ_1G+SZ_1K worth of buffers you should report the > result with more precision than GiB, but more than MiB seems a bit > overkill. > > BR, > -R > > > > > > > Signed-off-by: Adri=C3=A1n Larumbe > > > --- > > > drivers/gpu/drm/drm_file.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c > > > index 762965e3d503..bf7d2fe46bfa 100644 > > > --- a/drivers/gpu/drm/drm_file.c > > > +++ b/drivers/gpu/drm/drm_file.c > > > @@ -879,7 +879,7 @@ static void print_size(struct drm_printer *p, con= st char *stat, > > > unsigned u; > > > > > > for (u =3D 0; u < ARRAY_SIZE(units) - 1; u++) { > > > - if (sz < SZ_1K) btw, I was thinking more along the lines of: if (sz < 10*SZ_1K) (or perhaps maybe 100*SZ_1K) I mean, any visualization tool is going to scale the y axis based on the order of magnitude.. and if I'm looking at the fdinfo with my eyeballs I don't want to count the # of digits manually to do the conversion in my head. The difference btwn 4 or 5 or maybe 6 digits is easy enough to eyeball, but more than that is too much for my eyesight, and I'm not seeing how it is useful ;-) But if someone really has a valid use case for having precision in 1KB then I'm willing to be overruled. But I'm not a fan of the earlier approach of different drivers reporting results differently, the whole point of fdinfo was to have some standardized reporting. BR, -R > > > + if (sz & (SZ_1K - 1)) > > > break; > > > sz =3D div_u64(sz, SZ_1K); > > > } > >