[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230906101101.04f4e1a2@collabora.com>
Date: Wed, 6 Sep 2023 10:11:01 +0200
From: Boris Brezillon <boris.brezillon@...labora.com>
To: Adrián Larumbe <adrian.larumbe@...labora.com>
Cc: maarten.lankhorst@...ux.intel.com, mripard@...nel.org,
tzimmermann@...e.de, airlied@...il.com, daniel@...ll.ch,
robdclark@...il.com, quic_abhinavk@...cinc.com,
dmitry.baryshkov@...aro.org, sean@...rly.run,
marijn.suijten@...ainline.org, robh@...nel.org,
steven.price@....com, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
healych@...zon.com, kernel@...labora.com,
freedreno@...ts.freedesktop.org
Subject: Re: [PATCH v3 8/8] drm/drm-file: Show finer-grained BO sizes in
drm_show_memory_stats
On Tue, 5 Sep 2023 19:45:24 +0100
Adrián Larumbe <adrian.larumbe@...labora.com> wrote:
> The current implementation will try to pick the highest available size
> display unit as soon as the BO size exceeds that of the previous
> multiplier.
>
> By selecting a higher threshold, we could show more accurate size numbers.
>
> Signed-off-by: Adrián Larumbe <adrian.larumbe@...labora.com>
> ---
> 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..0b5fbd493e05 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, const char *stat,
> unsigned u;
>
> for (u = 0; u < ARRAY_SIZE(units) - 1; u++) {
> - if (sz < SZ_1K)
> + if (sz < (SZ_1K * 10000))
> break;
This threshold looks a bit random. How about picking a unit that allows
us to print the size with no precision loss?
for (u = 0; u < ARRAY_SIZE(units) - 1; u++) {
if (sz & (SZ_1K - 1))
break;
}
> sz = div_u64(sz, SZ_1K);
> }
Powered by blists - more mailing lists