From: sashiko-bot@kernel.org
To: "Rosen Penev" <rosenp@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm: i915: use kzalloc_flex
Date: Tue, 30 Jun 2026 01:27:46 +0000 [thread overview]
Message-ID: <20260630012747.038951F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260630011907.1453253-1-rosenp@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Flexible array conversion forces inefficient order-1 (8KB) allocations for page directories.
--
commit ed37e64eb293a3ef09353d34ef014044171cfe28
Author: Rosen Penev <rosenp@gmail.com>
drm: i915: use kzalloc_flex
This patch simplifies the allocation of i915_page_directory structures by
replacing a pointer with a flexible array member, consolidating two
allocations into one.
> diff --git a/drivers/gpu/drm/i915/gt/intel_gtt.h b/drivers/gpu/drm/i915/gt/intel_gtt.h
> index b54ee4f25af10..642b5c856a55a 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gtt.h
> +++ b/drivers/gpu/drm/i915/gt/intel_gtt.h
> @@ -186,7 +186,7 @@ struct i915_page_table {
> struct i915_page_directory {
> struct i915_page_table pt;
> spinlock_t lock;
> - void **entry;
> + void *entry[];
> };
>
> #define __px_choose_expr(x, type, expr, other) \
> diff --git a/drivers/gpu/drm/i915/gt/intel_ppgtt.c b/drivers/gpu/drm/i915/gt/intel_ppgtt.c
> index 72d8473a448b9..20cc59a005c97 100644
> --- a/drivers/gpu/drm/i915/gt/intel_ppgtt.c
> +++ b/drivers/gpu/drm/i915/gt/intel_ppgtt.c
> @@ -36,16 +36,10 @@ struct i915_page_directory *__alloc_pd(int count)
> {
> struct i915_page_directory *pd;
>
> - pd = kzalloc_obj(*pd, I915_GFP_ALLOW_FAIL);
> + pd = kzalloc_flex(*pd, entry, count, I915_GFP_ALLOW_FAIL);
[Severity: High]
Does this flexible array conversion force inefficient order-1 (8KB)
allocations for page directories?
Consolidating the entry array into struct i915_page_directory pushes the
allocation size from exactly 4096 bytes (for the array) to 4128 bytes. The
base struct is roughly 32 bytes, plus 512 * 8 bytes for the flexible array.
On systems with 4KB pages (like x86), a 4128-byte request cannot be satisfied
by the kmalloc-4k cache and spills over to the kmalloc-8k cache. This requires
an order-1 page allocation, wasting 4064 bytes per page directory and
significantly increasing the risk of allocation failures under memory
fragmentation compared to the previous order-0 allocation.
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260630011907.1453253-1-rosenp@gmail.com?part=1
next prev parent reply other threads:[~2026-06-30 1:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 1:19 [PATCH] drm: i915: use kzalloc_flex Rosen Penev
2026-06-30 1:27 ` sashiko-bot [this message]
2026-07-01 20:24 ` ✗ LGCI.VerificationFailed: failure for " Patchwork
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=20260630012747.038951F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=rosenp@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.