From: Boris Brezillon <boris.brezillon@collabora.com>
To: "Adrián Larumbe" <adrian.larumbe@collabora.com>
Cc: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch,
robdclark@gmail.com, 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
Subject: Re: [PATCH v3 8/8] drm/drm-file: Show finer-grained BO sizes in drm_show_memory_stats
Date: Mon, 11 Sep 2023 09:48:56 +0200 [thread overview]
Message-ID: <20230911094856.5c89aee5@collabora.com> (raw)
In-Reply-To: <dgo4x2tbdqvpfjf7cnspq2xvvkacc7pv2rdk5fesrqcv2xr3pi@mbwmqsg742hu>
On Sat, 9 Sep 2023 17:55:17 +0100
Adrián Larumbe <adrian.larumbe@collabora.com> wrote:
> On 06.09.2023 10:11, Boris Brezillon wrote:
> >On Tue, 5 Sep 2023 19:45:24 +0100
> >Adrián Larumbe <adrian.larumbe@collabora.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@collabora.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;
> > }
>
> In this case I picked up on Rob Clark's suggestion of choosing a hard limit of
> perhaps 10k or 100k times the current unit before moving on to the next one.
> While this approach guarantees that we don't lose precision, it would render a
> tad too long a number in KiB for BO's that aren't a multiple of a MiB.
I'd expect big BOs to have their size naturally aligned on something
bigger than a 4k page anyway, so I don't expect multi-MB/GB buffers to
be using the KiB unit in practice. It's just that it's weird to have,
8MiB printed as 8192KiB when we could have used the upper unit,
because it's naturally aligned on a megabyte.
Maybe we should have something like that instead:
for (u = 0; u < ARRAY_SIZE(units) - 1; u++) {
if ((sz & (SZ_1K - 1)) &&
sz < UPPER_UNIT_THRESHOLD * SZ_1K)
break;
sz = div_u64(sz, SZ_1K);
}
>
> >> sz = div_u64(sz, SZ_1K);
> >> }
prev parent reply other threads:[~2023-09-11 7:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-05 18:45 [PATCH v3 0/8] Add fdinfo support to Panfrost Adrián Larumbe
2023-09-05 18:45 ` [PATCH v3 1/8] drm/panfrost: Add cycle count GPU register definitions Adrián Larumbe
2023-09-05 18:45 ` [PATCH v3 2/8] drm/panfrost: Enable cycle counter register upon job submission Adrián Larumbe
2023-09-06 7:21 ` Boris Brezillon
2023-09-09 15:55 ` Adrián Larumbe
2023-09-06 7:57 ` Boris Brezillon
2023-09-09 15:28 ` Adrián Larumbe
2023-09-05 18:45 ` [PATCH v3 3/8] drm/panfrost: Enable debugfs toggling of cycle counter register Adrián Larumbe
2023-09-06 7:32 ` Boris Brezillon
2023-09-05 18:45 ` [PATCH v3 4/8] drm/panfrost: Add fdinfo support GPU load metrics Adrián Larumbe
2023-09-06 7:44 ` Boris Brezillon
2023-09-05 18:45 ` [PATCH v3 5/8] drm/panfrost: Add fdinfo support for memory stats Adrián Larumbe
2023-09-05 18:45 ` [PATCH v3 6/8] drm/drm_file: Add DRM obj's RSS reporting function for fdinfo Adrián Larumbe
2023-09-05 18:45 ` [PATCH v3 7/8] drm/panfrost: Implement generic DRM object RSS reporting function Adrián Larumbe
2023-09-06 8:01 ` Boris Brezillon
2023-09-09 16:42 ` Adrián Larumbe
2023-09-11 7:31 ` Boris Brezillon
2023-09-05 18:45 ` [PATCH v3 8/8] drm/drm-file: Show finer-grained BO sizes in drm_show_memory_stats Adrián Larumbe
2023-09-06 8:11 ` Boris Brezillon
2023-09-09 16:55 ` Adrián Larumbe
2023-09-11 7:48 ` Boris Brezillon [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230911094856.5c89aee5@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=adrian.larumbe@collabora.com \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=healych@amazon.com \
--cc=kernel@collabora.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marijn.suijten@somainline.org \
--cc=mripard@kernel.org \
--cc=quic_abhinavk@quicinc.com \
--cc=robdclark@gmail.com \
--cc=robh@kernel.org \
--cc=sean@poorly.run \
--cc=steven.price@arm.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox