[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ccfa3697-b015-ff35-fb92-0efcbd1d7d7c@linux.intel.com>
Date: Wed, 20 Sep 2023 16:32:46 +0100
From: Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>
To: Adrián Larumbe <adrian.larumbe@...labora.com>,
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
Cc: linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org, healych@...zon.com,
Boris Brezillon <boris.brezillon@...labora.com>,
kernel@...labora.com, freedreno@...ts.freedesktop.org
Subject: Re: [PATCH v6 6/6] drm/drm-file: Show finer-grained BO sizes in
drm_show_memory_stats
On 20/09/2023 00:34, Adrián Larumbe 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. That can lead to loss of precision in contexts of low memory
> usage.
>
> The new selection criteria try to preserve precision, whilst also
> increasing the display unit selection threshold to render more accurate
> values.
>
> Signed-off-by: Adrián Larumbe <adrian.larumbe@...labora.com>
> Reviewed-by: Boris Brezillon <boris.brezillon@...labora.com>
> Reviewed-by: Steven Price <steven.price@....com>
> ---
> drivers/gpu/drm/drm_file.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
> index 762965e3d503..34cfa128ffe5 100644
> --- a/drivers/gpu/drm/drm_file.c
> +++ b/drivers/gpu/drm/drm_file.c
> @@ -872,6 +872,8 @@ void drm_send_event(struct drm_device *dev, struct drm_pending_event *e)
> }
> EXPORT_SYMBOL(drm_send_event);
>
> +#define UPPER_UNIT_THRESHOLD 100
> +
> static void print_size(struct drm_printer *p, const char *stat,
> const char *region, u64 sz)
> {
> @@ -879,7 +881,8 @@ 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 - 1)) &&
IS_ALIGNED worth it at all?
> + sz < UPPER_UNIT_THRESHOLD * SZ_1K)
> break;
Excuse me for a late comment (I was away). I did not get what what is
special about a ~10% threshold? Sounds to me just going with the lower
unit, when size is not aligned to the higher one, would be better than
sometimes precision-sometimes-not.
Regards,
Tvrtko
> sz = div_u64(sz, SZ_1K);
> }
Powered by blists - more mailing lists